Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
6e276581
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看板
未验证
提交
6e276581
编写于
10月 09, 2022
作者:
O
openharmony_ci
提交者:
Gitee
10月 09, 2022
浏览文件
操作
浏览文件
下载
差异文件
!10219 continuationManager 错误码整改
Merge pull request !10219 from 杜智海/master
上级
6b68975a
2146777b
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
798 addition
and
117 deletion
+798
-117
zh-cn/application-dev/ability/continuationmanager.md
zh-cn/application-dev/ability/continuationmanager.md
+94
-71
zh-cn/application-dev/reference/apis/js-apis-continuation-continuationManager.md
...eference/apis/js-apis-continuation-continuationManager.md
+447
-46
zh-cn/application-dev/reference/errorcodes/errcode-DistributedSchedule.md
...n-dev/reference/errorcodes/errcode-DistributedSchedule.md
+257
-0
未找到文件。
zh-cn/application-dev/ability/continuationmanager.md
浏览文件 @
6e276581
...
@@ -12,20 +12,20 @@ continuationManager作为流转能力的入口,主要用于拉起系统中的
...
@@ -12,20 +12,20 @@ continuationManager作为流转能力的入口,主要用于拉起系统中的
## 接口说明
## 接口说明
| 接口名 | 接口描述 |
| 接口名 | 接口描述 |
| ---------------------------------------------------------------------------------------------- | ----------- |
| ---------------------------------------------------------------------------------------------- | ----------- |
| register(callback: AsyncCallback
\<
number>): void | 注册流转管理服务,并获取对应的注册token,无过滤条件(AsyncCallback)。 |
| register
Continuation
(callback: AsyncCallback
\<
number>): void | 注册流转管理服务,并获取对应的注册token,无过滤条件(AsyncCallback)。 |
| register(options: ContinuationExtraParams, callback: AsyncCallback
\<
number>): void | 注册流转管理服务,并获取对应的注册token(AsyncCallback)。 |
| register
Continuation
(options: ContinuationExtraParams, callback: AsyncCallback
\<
number>): void | 注册流转管理服务,并获取对应的注册token(AsyncCallback)。 |
| register(options?: ContinuationExtraParams): Promise
\<
number> | 连接流转管理服务,并获取对应的注册token(Promise)。 |
| register
Continuation
(options?: ContinuationExtraParams): Promise
\<
number> | 连接流转管理服务,并获取对应的注册token(Promise)。 |
| on(type: "deviceConnect", token: number, callback: Callback
\<
Array
\<
ContinuationResult>>): void | 监听设备连接状态(Callback)。 |
| on(type: "deviceConnect", token: number, callback: Callback
\<
Array
\<
ContinuationResult>>): void | 监听设备连接状态(Callback)。 |
| on(type: "deviceDisconnect", token: number, callback: Callback
\<
Array
\<
string>>): void | 监听设备断开状态(Callback)。 |
| on(type: "deviceDisconnect", token: number, callback: Callback
\<
Array
\<
string>>): void | 监听设备断开状态(Callback)。 |
| off(type: "deviceConnect", token: number): void | 取消监听设备连接状态。 |
| off(type: "deviceConnect", token: number): void | 取消监听设备连接状态。 |
| off(type: "deviceDisconnect", token: number): void | 取消监听设备断开状态。 |
| off(type: "deviceDisconnect", token: number): void | 取消监听设备断开状态。 |
| startDeviceManager(token: number, callback: AsyncCallback
\<
void>): void | 拉起设备选择模块,可显示组网内可选择设备列表信息,无过滤条件(AsyncCallback)。 |
| start
Continuation
DeviceManager(token: number, callback: AsyncCallback
\<
void>): void | 拉起设备选择模块,可显示组网内可选择设备列表信息,无过滤条件(AsyncCallback)。 |
| startDeviceManager(token: number, options: ContinuationExtraParams, callback: AsyncCallback
\<
void>): void | 拉起设备选择模块,可显示组网内可选择设备列表信息(AsyncCallback)。 |
| start
Continuation
DeviceManager(token: number, options: ContinuationExtraParams, callback: AsyncCallback
\<
void>): void | 拉起设备选择模块,可显示组网内可选择设备列表信息(AsyncCallback)。 |
| startDeviceManager(token: number, options?: ContinuationExtraParams): Promise
\<
void> | 拉起设备选择模块,可显示组网内可选择设备列表信息(Promise)。 |
| start
Continuation
DeviceManager(token: number, options?: ContinuationExtraParams): Promise
\<
void> | 拉起设备选择模块,可显示组网内可选择设备列表信息(Promise)。 |
| updateCon
nectStatus
(token: number, deviceId: string, status: DeviceConnectState, callback: AsyncCallback
\<
void>): void | 通知设备选择模块,更新当前的流转状态(AsyncCallback)。 |
| updateCon
tinuationState
(token: number, deviceId: string, status: DeviceConnectState, callback: AsyncCallback
\<
void>): void | 通知设备选择模块,更新当前的流转状态(AsyncCallback)。 |
| updateCon
nectStatus
(token: number, deviceId: string, status: DeviceConnectState): Promise
\<
void> | 通知设备选择模块,更新当前的流转状态(Promise)。 |
| updateCon
tinuationState
(token: number, deviceId: string, status: DeviceConnectState): Promise
\<
void> | 通知设备选择模块,更新当前的流转状态(Promise)。 |
| unregister(token: number, callback: AsyncCallback
\<
void>): void | 取消注册流转管理服务,传入注册时获取的token进行取消注册(AsyncCallback)。 |
| unregister
Continuation
(token: number, callback: AsyncCallback
\<
void>): void | 取消注册流转管理服务,传入注册时获取的token进行取消注册(AsyncCallback)。 |
| unregister(token: number): Promise
\<
void> | 取消注册流转管理服务,传入注册时获取的token进行取消注册(Promise)。 |
| unregister
Continuation
(token: number): Promise
\<
void> | 取消注册流转管理服务,传入注册时获取的token进行取消注册(Promise)。 |
## 开发步骤
## 开发步骤
1.
导入continuationManager模块。
1.
导入continuationManager模块。
...
@@ -138,13 +138,16 @@ continuationManager作为流转能力的入口,主要用于拉起系统中的
...
@@ -138,13 +138,16 @@ continuationManager作为流转能力的入口,主要用于拉起系统中的
```
ts
```
ts
let
token
:
number
=
-
1
;
// 用于保存注册成功并返回的token,后续使用其完成监听设备连接/断开状态、拉起设备选择模块以及更新流转状态的动作
let
token
:
number
=
-
1
;
// 用于保存注册成功并返回的token,后续使用其完成监听设备连接/断开状态、拉起设备选择模块以及更新流转状态的动作
try
{
continuationManager
.
register
().
then
((
data
)
=>
{
continuationManager
.
registerContinuation
().
then
((
data
)
=>
{
console
.
info
(
'
register
finished,
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
registerContinuation
finished,
'
+
JSON
.
stringify
(
data
));
token
=
data
;
// 获取到对应的注册token,并赋值给token变量
token
=
data
;
// 获取到对应的注册token,并赋值给token变量
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
register
failed, cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
registerContinuation
failed, cause:
'
+
JSON
.
stringify
(
err
));
});
});
}
catch
(
err
)
{
console
.
error
(
'
registerContinuation failed, cause:
'
+
JSON
.
stringify
(
err
));
}
```
```
4.
监听设备状态。
4.
监听设备状态。
...
@@ -154,6 +157,7 @@ continuationManager作为流转能力的入口,主要用于拉起系统中的
...
@@ -154,6 +157,7 @@ continuationManager作为流转能力的入口,主要用于拉起系统中的
```
ts
```
ts
let
remoteDeviceId
:
string
=
""
;
// 用于保存用户选择的远端设备信息,后续使用其完成跨端迁移或多端协同操作
let
remoteDeviceId
:
string
=
""
;
// 用于保存用户选择的远端设备信息,后续使用其完成跨端迁移或多端协同操作
try
{
// 参数token为注册token
// 参数token为注册token
continuationManager
.
on
(
"
deviceConnect
"
,
token
,
(
continuationResults
)
=>
{
continuationManager
.
on
(
"
deviceConnect
"
,
token
,
(
continuationResults
)
=>
{
console
.
info
(
'
registerDeviceConnectCallback len:
'
+
continuationResults
.
length
);
console
.
info
(
'
registerDeviceConnectCallback len:
'
+
continuationResults
.
length
);
...
@@ -176,6 +180,9 @@ continuationManager作为流转能力的入口,主要用于拉起系统中的
...
@@ -176,6 +180,9 @@ continuationManager作为流转能力的入口,主要用于拉起系统中的
console
.
error
(
'
StartRemoteAbility failed, cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
StartRemoteAbility failed, cause:
'
+
JSON
.
stringify
(
err
));
});
});
});
});
}
catch
(
err
)
{
console
.
error
(
'
on failed, cause:
'
+
JSON
.
stringify
(
err
));
}
```
```
上述多端协同操作为Stage平台的跨设备拉起,FA平台详情见
[
PageAbility开发指导
](
https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/ability/fa-pageability.md
)
。
上述多端协同操作为Stage平台的跨设备拉起,FA平台详情见
[
PageAbility开发指导
](
https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/ability/fa-pageability.md
)
。
...
@@ -187,16 +194,21 @@ continuationManager作为流转能力的入口,主要用于拉起系统中的
...
@@ -187,16 +194,21 @@ continuationManager作为流转能力的入口,主要用于拉起系统中的
let
deviceConnectStatus
:
continuationManager
.
DeviceConnectState
=
continuationManager
.
DeviceConnectState
.
CONNECTED
;
let
deviceConnectStatus
:
continuationManager
.
DeviceConnectState
=
continuationManager
.
DeviceConnectState
.
CONNECTED
;
// 参数token为注册token,参数remoteDeviceId为获取到的remoteDeviceId
// 参数token为注册token,参数remoteDeviceId为获取到的remoteDeviceId
continuationManager
.
updateConnectStatus
(
token
,
remoteDeviceId
,
deviceConnectStatus
).
then
((
data
)
=>
{
try
{
console
.
info
(
'
updateConnectStatus finished,
'
+
JSON
.
stringify
(
data
));
continuationManager
.
updateContinuationState
(
token
,
remoteDeviceId
,
deviceConnectStatus
).
then
((
data
)
=>
{
console
.
info
(
'
updateContinuationState finished,
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
updateConnectStatus
failed, cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
updateContinuationState
failed, cause:
'
+
JSON
.
stringify
(
err
));
});
});
}
catch
(
err
)
{
console
.
error
(
'
updateContinuationState failed, cause:
'
+
JSON
.
stringify
(
err
));
}
```
```
监听设备断开状态,方便用户终止跨端迁移或多端协同操作,代码示例如下:
监听设备断开状态,方便用户终止跨端迁移或多端协同操作,代码示例如下:
```
ts
```
ts
try
{
// 参数token为注册token
// 参数token为注册token
continuationManager
.
on
(
"
deviceDisconnect
"
,
token
,
(
deviceIds
)
=>
{
continuationManager
.
on
(
"
deviceDisconnect
"
,
token
,
(
deviceIds
)
=>
{
console
.
info
(
'
onDeviceDisconnect len:
'
+
deviceIds
.
length
);
console
.
info
(
'
onDeviceDisconnect len:
'
+
deviceIds
.
length
);
...
@@ -210,12 +222,15 @@ continuationManager作为流转能力的入口,主要用于拉起系统中的
...
@@ -210,12 +222,15 @@ continuationManager作为流转能力的入口,主要用于拉起系统中的
let
deviceConnectStatus
:
continuationManager
.
DeviceConnectState
=
continuationManager
.
DeviceConnectState
.
DISCONNECTING
;
// 设备断开状态
let
deviceConnectStatus
:
continuationManager
.
DeviceConnectState
=
continuationManager
.
DeviceConnectState
.
DISCONNECTING
;
// 设备断开状态
// 参数token为注册token,参数unselectedDeviceId为获取到的unselectedDeviceId
// 参数token为注册token,参数unselectedDeviceId为获取到的unselectedDeviceId
continuationManager
.
updateConnectStatus
(
token
,
unselectedDeviceId
,
deviceConnectStatus
).
then
((
data
)
=>
{
continuationManager
.
updateContinuationState
(
token
,
unselectedDeviceId
,
deviceConnectStatus
).
then
((
data
)
=>
{
console
.
info
(
'
updateConnectStatus
finished,
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
updateContinuationState
finished,
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
updateConnectStatus
failed, cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
updateContinuationState
failed, cause:
'
+
JSON
.
stringify
(
err
));
});
});
});
});
}
catch
(
err
)
{
console
.
error
(
'
updateContinuationState failed, cause:
'
+
JSON
.
stringify
(
err
));
}
```
```
5.
拉起设备选择模块,可显示组网内可选择设备列表信息,供用户选择。
5.
拉起设备选择模块,可显示组网内可选择设备列表信息,供用户选择。
...
@@ -229,12 +244,16 @@ continuationManager作为流转能力的入口,主要用于拉起系统中的
...
@@ -229,12 +244,16 @@ continuationManager作为流转能力的入口,主要用于拉起系统中的
continuationMode
:
continuationManager
.
ContinuationMode
.
COLLABORATION_SINGLE
// 设备选择模块单选模式
continuationMode
:
continuationManager
.
ContinuationMode
.
COLLABORATION_SINGLE
// 设备选择模块单选模式
};
};
try
{
// 参数token为注册token
// 参数token为注册token
continuationManager
.
start
DeviceManager
(
token
,
continuationExtraParams
).
then
((
data
)
=>
{
continuationManager
.
startContinuation
DeviceManager
(
token
,
continuationExtraParams
).
then
((
data
)
=>
{
console
.
info
(
'
start
DeviceManager finished,
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
startContinuation
DeviceManager finished,
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
start
DeviceManager failed, cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
startContinuation
DeviceManager failed, cause:
'
+
JSON
.
stringify
(
err
));
});
});
}
catch
(
err
)
{
console
.
error
(
'
startContinuationDeviceManager failed, cause:
'
+
JSON
.
stringify
(
err
));
}
```
```
6.
当用户不打算再进行跨端迁移或多端协同操作时,可以传入注册时获取的token进行取消注册。
6.
当用户不打算再进行跨端迁移或多端协同操作时,可以传入注册时获取的token进行取消注册。
...
@@ -242,10 +261,14 @@ continuationManager作为流转能力的入口,主要用于拉起系统中的
...
@@ -242,10 +261,14 @@ continuationManager作为流转能力的入口,主要用于拉起系统中的
取消注册流转管理服务的代码示例如下:
取消注册流转管理服务的代码示例如下:
```
ts
```
ts
try
{
// 参数token为注册token
// 参数token为注册token
continuationManager
.
unregister
(
token
).
then
((
data
)
=>
{
continuationManager
.
unregisterContinuation
(
token
).
then
((
data
)
=>
{
console
.
info
(
'
unregister
finished,
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
unregisterContinuation
finished,
'
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
'
unregister
failed, cause:
'
+
JSON
.
stringify
(
err
));
console
.
error
(
'
unregisterContinuation
failed, cause:
'
+
JSON
.
stringify
(
err
));
});
});
}
catch
(
err
)
{
console
.
error
(
'
unregisterContinuation failed, cause:
'
+
JSON
.
stringify
(
err
));
}
```
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-continuation-continuationManager.md
浏览文件 @
6e276581
...
@@ -10,16 +10,18 @@ continuationManager模块提供了流转/协同入口管理服务能力,包括
...
@@ -10,16 +10,18 @@ continuationManager模块提供了流转/协同入口管理服务能力,包括
## 导入模块
## 导入模块
```
j
s
```
t
s
import
continuationManager
from
'
@ohos.continuation.continuationManager
'
import
continuationManager
from
'
@ohos.continuation.continuationManager
'
```
```
## continuationManager.register
## continuationManager.register
<sup>(deprecated)</sup>
register(callback: AsyncCallback
\<
number>): void;
register(callback: AsyncCallback
\<
number>): void;
注册流转管理服务,并获取对应的注册token,无过滤条件,使用AsyncCallback方式作为异步方法。
注册流转管理服务,并获取对应的注册token,无过滤条件,使用AsyncCallback方式作为异步方法。
> 从API Version 9开始不再维护,建议使用[registerContinuation](#continuationmanagerregistercontinuation9)替代。
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**参数:**
**参数:**
...
@@ -30,7 +32,7 @@ register(callback: AsyncCallback\<number>): void;
...
@@ -30,7 +32,7 @@ register(callback: AsyncCallback\<number>): void;
**示例:**
**示例:**
```
j
s
```
t
s
let
token
=
-
1
;
let
token
=
-
1
;
continuationManager
.
register
((
err
,
data
)
=>
{
continuationManager
.
register
((
err
,
data
)
=>
{
if
(
err
.
code
!=
0
)
{
if
(
err
.
code
!=
0
)
{
...
@@ -42,12 +44,14 @@ register(callback: AsyncCallback\<number>): void;
...
@@ -42,12 +44,14 @@ register(callback: AsyncCallback\<number>): void;
});
});
```
```
## continuationManager.register
## continuationManager.register
<sup>(deprecated)</sup>
register(options: ContinuationExtraParams, callback: AsyncCallback
\<
number>): void;
register(options: ContinuationExtraParams, callback: AsyncCallback
\<
number>): void;
连接流转管理服务,并获取对应的注册token,使用AsyncCallback方式作为异步方法。
连接流转管理服务,并获取对应的注册token,使用AsyncCallback方式作为异步方法。
> 从API Version 9开始不再维护,建议使用[registerContinuation](#continuationmanagerregistercontinuation9)替代。
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**参数:**
**参数:**
...
@@ -59,7 +63,7 @@ register(options: ContinuationExtraParams, callback: AsyncCallback\<number>): vo
...
@@ -59,7 +63,7 @@ register(options: ContinuationExtraParams, callback: AsyncCallback\<number>): vo
**示例:**
**示例:**
```
j
s
```
t
s
let
token
=
-
1
;
let
token
=
-
1
;
let
continuationExtraParams
=
{
let
continuationExtraParams
=
{
deviceType
:
[
"
00E
"
]
deviceType
:
[
"
00E
"
]
...
@@ -74,12 +78,14 @@ register(options: ContinuationExtraParams, callback: AsyncCallback\<number>): vo
...
@@ -74,12 +78,14 @@ register(options: ContinuationExtraParams, callback: AsyncCallback\<number>): vo
});
});
```
```
## continuationManager.register
## continuationManager.register
<sup>(deprecated)</sup>
register(options?: ContinuationExtraParams): Promise
\<
number>;
register(options?: ContinuationExtraParams): Promise
\<
number>;
连接流转管理服务,并获取对应的注册token,使用Promise方式作为异步方法。
连接流转管理服务,并获取对应的注册token,使用Promise方式作为异步方法。
> 从API Version 9开始不再维护,建议使用[registerContinuation](#continuationmanagerregistercontinuation9)替代。
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**参数:**
**参数:**
...
@@ -96,7 +102,7 @@ register(options?: ContinuationExtraParams): Promise\<number>;
...
@@ -96,7 +102,7 @@ register(options?: ContinuationExtraParams): Promise\<number>;
**示例:**
**示例:**
```
j
s
```
t
s
let
token
=
-
1
;
let
token
=
-
1
;
let
continuationExtraParams
=
{
let
continuationExtraParams
=
{
deviceType
:
[
"
00E
"
]
deviceType
:
[
"
00E
"
]
...
@@ -111,6 +117,116 @@ register(options?: ContinuationExtraParams): Promise\<number>;
...
@@ -111,6 +117,116 @@ register(options?: ContinuationExtraParams): Promise\<number>;
});
});
```
```
## continuationManager.registerContinuation<sup>9+</sup>
registerContinuation(callback: AsyncCallback
\<
number>): void;
注册流转管理服务,并获取对应的注册token,无过滤条件,使用AsyncCallback方式作为异步方法。
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback
\<
number> | 是 | AsyncCallback形式返回流转管理服务连接后生成的token。 |
**示例:**
```
ts
let
token
=
-
1
;
try
{
continuationManager
.
registerContinuation
((
err
,
data
)
=>
{
if
(
err
.
code
!=
0
)
{
console
.
error
(
'
registerContinuation failed, cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
registerContinuation finished,
'
+
JSON
.
stringify
(
data
));
token
=
data
;
});
}
catch
(
err
)
{
console
.
error
(
'
registerContinuation failed, cause:
'
+
JSON
.
stringify
(
err
));
}
```
## continuationManager.registerContinuation<sup>9+</sup>
registerContinuation(options: ContinuationExtraParams, callback: AsyncCallback
\<
number>): void;
连接流转管理服务,并获取对应的注册token,使用AsyncCallback方式作为异步方法。
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| options |
[
ContinuationExtraParams
](
js-apis-continuation-continuationExtraParams.md
)
| 是 | 过滤可选择设备列表的额外参数。 |
| callback | AsyncCallback
\<
number> | 是 | AsyncCallback形式返回流转管理服务连接后生成的token。 |
**示例:**
```
ts
let
token
=
-
1
;
let
continuationExtraParams
=
{
deviceType
:
[
"
00E
"
]
};
try
{
continuationManager
.
registerContinuation
(
continuationExtraParams
,
(
err
,
data
)
=>
{
if
(
err
.
code
!=
0
)
{
console
.
error
(
'
registerContinuation failed, cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
registerContinuation finished,
'
+
JSON
.
stringify
(
data
));
token
=
data
;
});
}
catch
(
err
)
{
console
.
error
(
'
registerContinuation failed, cause:
'
+
JSON
.
stringify
(
err
));
}
```
## continuationManager.registerContinuation<sup>9+</sup>
registerContinuation(options?: ContinuationExtraParams): Promise
\<
number>;
连接流转管理服务,并获取对应的注册token,使用Promise方式作为异步方法。
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| options |
[
ContinuationExtraParams
](
js-apis-continuation-continuationExtraParams.md
)
| 否 | 过滤可选择设备列表的额外参数,该参数可缺省|
**返回值:**
| 类型 | 说明 |
| ------------------------- | ------------------ |
| Promise
\<
number> | Promise形式返回流转管理服务连接后生成的token。 |
**示例:**
```
ts
let
token
=
-
1
;
let
continuationExtraParams
=
{
deviceType
:
[
"
00E
"
]
};
try
{
continuationManager
.
register
(
continuationExtraParams
)
.
then
((
data
)
=>
{
console
.
info
(
'
registerContinuation finished,
'
+
JSON
.
stringify
(
data
));
token
=
data
;
})
.
catch
((
err
)
=>
{
console
.
error
(
'
registerContinuation failed, cause:
'
+
JSON
.
stringify
(
err
));
});
}
catch
(
err
)
{
console
.
error
(
'
registerContinuation failed, cause:
'
+
JSON
.
stringify
(
err
));
}
```
## continuationManager.on("deviceConnect")<sup>(deprecated)</sup>
## continuationManager.on("deviceConnect")<sup>(deprecated)</sup>
on(type: "deviceConnect", callback: Callback
\<
ContinuationResult>): void;
on(type: "deviceConnect", callback: Callback
\<
ContinuationResult>): void;
...
@@ -130,7 +246,7 @@ on(type: "deviceConnect", callback: Callback\<ContinuationResult>): void;
...
@@ -130,7 +246,7 @@ on(type: "deviceConnect", callback: Callback\<ContinuationResult>): void;
**示例:**
**示例:**
```
j
s
```
t
s
continuationManager
.
on
(
"
deviceConnect
"
,
(
data
)
=>
{
continuationManager
.
on
(
"
deviceConnect
"
,
(
data
)
=>
{
console
.
info
(
'
onDeviceConnect deviceId:
'
+
JSON
.
stringify
(
data
.
id
));
console
.
info
(
'
onDeviceConnect deviceId:
'
+
JSON
.
stringify
(
data
.
id
));
console
.
info
(
'
onDeviceConnect deviceType:
'
+
JSON
.
stringify
(
data
.
type
));
console
.
info
(
'
onDeviceConnect deviceType:
'
+
JSON
.
stringify
(
data
.
type
));
...
@@ -157,7 +273,7 @@ on(type: "deviceDisconnect", callback: Callback\<string>): void;
...
@@ -157,7 +273,7 @@ on(type: "deviceDisconnect", callback: Callback\<string>): void;
**示例:**
**示例:**
```
j
s
```
t
s
continuationManager
.
on
(
"
deviceDisconnect
"
,
(
data
)
=>
{
continuationManager
.
on
(
"
deviceDisconnect
"
,
(
data
)
=>
{
console
.
info
(
'
onDeviceDisconnect deviceId:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
onDeviceDisconnect deviceId:
'
+
JSON
.
stringify
(
data
));
});
});
...
@@ -182,7 +298,7 @@ off(type: "deviceConnect", callback?: Callback\<ContinuationResult>): void;
...
@@ -182,7 +298,7 @@ off(type: "deviceConnect", callback?: Callback\<ContinuationResult>): void;
**示例:**
**示例:**
```
j
s
```
t
s
continuationManager
.
off
(
"
deviceConnect
"
,
(
data
)
=>
{
continuationManager
.
off
(
"
deviceConnect
"
,
(
data
)
=>
{
console
.
info
(
'
onDeviceConnect deviceId:
'
+
JSON
.
stringify
(
data
.
id
));
console
.
info
(
'
onDeviceConnect deviceId:
'
+
JSON
.
stringify
(
data
.
id
));
console
.
info
(
'
onDeviceConnect deviceType:
'
+
JSON
.
stringify
(
data
.
type
));
console
.
info
(
'
onDeviceConnect deviceType:
'
+
JSON
.
stringify
(
data
.
type
));
...
@@ -209,7 +325,7 @@ off(type: "deviceDisconnect", callback?: Callback\<string>): void;
...
@@ -209,7 +325,7 @@ off(type: "deviceDisconnect", callback?: Callback\<string>): void;
**示例:**
**示例:**
```
j
s
```
t
s
continuationManager
.
off
(
"
deviceDisconnect
"
,
(
data
)
=>
{
continuationManager
.
off
(
"
deviceDisconnect
"
,
(
data
)
=>
{
console
.
info
(
'
onDeviceDisconnect deviceId:
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
onDeviceDisconnect deviceId:
'
+
JSON
.
stringify
(
data
));
});
});
...
@@ -233,8 +349,9 @@ on(type: "deviceConnect", token: number, callback: Callback\<Array\<Continuation
...
@@ -233,8 +349,9 @@ on(type: "deviceConnect", token: number, callback: Callback\<Array\<Continuation
**示例:**
**示例:**
```
j
s
```
t
s
let
token
=
1
;
let
token
=
1
;
try
{
continuationManager
.
on
(
"
deviceConnect
"
,
token
,
(
data
)
=>
{
continuationManager
.
on
(
"
deviceConnect
"
,
token
,
(
data
)
=>
{
console
.
info
(
'
onDeviceConnect len:
'
+
data
.
length
);
console
.
info
(
'
onDeviceConnect len:
'
+
data
.
length
);
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
...
@@ -243,6 +360,9 @@ on(type: "deviceConnect", token: number, callback: Callback\<Array\<Continuation
...
@@ -243,6 +360,9 @@ on(type: "deviceConnect", token: number, callback: Callback\<Array\<Continuation
console
.
info
(
'
onDeviceConnect deviceName:
'
+
JSON
.
stringify
(
data
[
i
].
name
));
console
.
info
(
'
onDeviceConnect deviceName:
'
+
JSON
.
stringify
(
data
[
i
].
name
));
}
}
});
});
}
catch
(
err
)
{
console
.
error
(
'
on failed, cause:
'
+
JSON
.
stringify
(
err
));
}
```
```
## continuationManager.on("deviceDisconnect")<sup>9+</sup>
## continuationManager.on("deviceDisconnect")<sup>9+</sup>
...
@@ -263,8 +383,9 @@ on(type: "deviceDisconnect", token: number, callback: Callback\<Array\<string>>)
...
@@ -263,8 +383,9 @@ on(type: "deviceDisconnect", token: number, callback: Callback\<Array\<string>>)
**示例:**
**示例:**
```
j
s
```
t
s
let
token
=
1
;
let
token
=
1
;
try
{
continuationManager
.
on
(
"
deviceDisconnect
"
,
token
,
(
data
)
=>
{
continuationManager
.
on
(
"
deviceDisconnect
"
,
token
,
(
data
)
=>
{
console
.
info
(
'
onDeviceDisconnect len:
'
+
data
.
length
);
console
.
info
(
'
onDeviceDisconnect len:
'
+
data
.
length
);
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
...
@@ -272,6 +393,9 @@ on(type: "deviceDisconnect", token: number, callback: Callback\<Array\<string>>)
...
@@ -272,6 +393,9 @@ on(type: "deviceDisconnect", token: number, callback: Callback\<Array\<string>>)
}
}
console
.
info
(
'
onDeviceDisconnect finished.
'
);
console
.
info
(
'
onDeviceDisconnect finished.
'
);
});
});
}
catch
(
err
)
{
console
.
error
(
'
on failed, cause:
'
+
JSON
.
stringify
(
err
));
}
```
```
## continuationManager.off("deviceConnect")<sup>9+</sup>
## continuationManager.off("deviceConnect")<sup>9+</sup>
...
@@ -291,9 +415,13 @@ off(type: "deviceConnect", token: number): void;
...
@@ -291,9 +415,13 @@ off(type: "deviceConnect", token: number): void;
**示例:**
**示例:**
```
j
s
```
t
s
let
token
=
1
;
let
token
=
1
;
try
{
continuationManager
.
off
(
"
deviceConnect
"
,
token
);
continuationManager
.
off
(
"
deviceConnect
"
,
token
);
}
catch
(
err
)
{
console
.
error
(
'
off failed, cause:
'
+
JSON
.
stringify
(
err
));
}
```
```
## continuationManager.off("deviceDisconnect")<sup>9+</sup>
## continuationManager.off("deviceDisconnect")<sup>9+</sup>
...
@@ -313,17 +441,23 @@ off(type: "deviceDisconnect", token: number): void;
...
@@ -313,17 +441,23 @@ off(type: "deviceDisconnect", token: number): void;
**示例:**
**示例:**
```
j
s
```
t
s
let
token
=
1
;
let
token
=
1
;
try
{
continuationManager
.
off
(
"
deviceDisconnect
"
,
token
);
continuationManager
.
off
(
"
deviceDisconnect
"
,
token
);
}
catch
(
err
)
{
console
.
error
(
'
off failed, cause:
'
+
JSON
.
stringify
(
err
));
}
```
```
## continuationManager.startDeviceManager
## continuationManager.startDeviceManager
<sup>(deprecated)</sup>
startDeviceManager(token: number, callback: AsyncCallback
\<
void>): void;
startDeviceManager(token: number, callback: AsyncCallback
\<
void>): void;
拉起设备选择模块,可显示组网内可选择设备列表信息,无过滤条件,使用AsyncCallback方式作为异步方法。
拉起设备选择模块,可显示组网内可选择设备列表信息,无过滤条件,使用AsyncCallback方式作为异步方法。
> 从API Version 9开始不再维护,建议使用[startContinuationDeviceManager](#continuationmanagerondeviceconnect9)替代。
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**参数:**
**参数:**
...
@@ -335,7 +469,7 @@ startDeviceManager(token: number, callback: AsyncCallback\<void>): void;
...
@@ -335,7 +469,7 @@ startDeviceManager(token: number, callback: AsyncCallback\<void>): void;
**示例:**
**示例:**
```
j
s
```
t
s
let
token
=
1
;
let
token
=
1
;
continuationManager
.
startDeviceManager
(
token
,
(
err
,
data
)
=>
{
continuationManager
.
startDeviceManager
(
token
,
(
err
,
data
)
=>
{
if
(
err
.
code
!=
0
)
{
if
(
err
.
code
!=
0
)
{
...
@@ -346,12 +480,14 @@ startDeviceManager(token: number, callback: AsyncCallback\<void>): void;
...
@@ -346,12 +480,14 @@ startDeviceManager(token: number, callback: AsyncCallback\<void>): void;
});
});
```
```
## continuationManager.startDeviceManager
## continuationManager.startDeviceManager
<sup>(deprecated)</sup>
startDeviceManager(token: number, options: ContinuationExtraParams, callback: AsyncCallback
\<
void>): void;
startDeviceManager(token: number, options: ContinuationExtraParams, callback: AsyncCallback
\<
void>): void;
拉起设备选择模块,可显示组网内可选择设备列表信息,使用AsyncCallback方式作为异步方法。
拉起设备选择模块,可显示组网内可选择设备列表信息,使用AsyncCallback方式作为异步方法。
> 从API Version 9开始不再维护,建议使用[startContinuationDeviceManager](#continuationmanagerstartcontinuationdevicemanager9)替代。
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**参数:**
**参数:**
...
@@ -364,7 +500,7 @@ startDeviceManager(token: number, options: ContinuationExtraParams, callback: As
...
@@ -364,7 +500,7 @@ startDeviceManager(token: number, options: ContinuationExtraParams, callback: As
**示例:**
**示例:**
```
j
s
```
t
s
let
token
=
1
;
let
token
=
1
;
let
continuationExtraParams
=
{
let
continuationExtraParams
=
{
deviceType
:
[
"
00E
"
]
deviceType
:
[
"
00E
"
]
...
@@ -378,12 +514,14 @@ startDeviceManager(token: number, options: ContinuationExtraParams, callback: As
...
@@ -378,12 +514,14 @@ startDeviceManager(token: number, options: ContinuationExtraParams, callback: As
});
});
```
```
## continuationManager.startDeviceManager
## continuationManager.startDeviceManager
<sup>(deprecated)</sup>
startDeviceManager(token: number, options?: ContinuationExtraParams): Promise
\<
void>;
startDeviceManager(token: number, options?: ContinuationExtraParams): Promise
\<
void>;
拉起设备选择模块,可显示组网内可选择设备列表信息,使用Promise方式作为异步方法。
拉起设备选择模块,可显示组网内可选择设备列表信息,使用Promise方式作为异步方法。
> 从API Version 9开始不再维护,建议使用[startContinuationDeviceManager](#continuationmanagerstartcontinuationdevicemanager9)替代。
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**参数:**
**参数:**
...
@@ -401,7 +539,7 @@ startDeviceManager(token: number, options?: ContinuationExtraParams): Promise\<v
...
@@ -401,7 +539,7 @@ startDeviceManager(token: number, options?: ContinuationExtraParams): Promise\<v
**示例:**
**示例:**
```
j
s
```
t
s
let
token
=
1
;
let
token
=
1
;
let
continuationExtraParams
=
{
let
continuationExtraParams
=
{
deviceType
:
[
"
00E
"
]
deviceType
:
[
"
00E
"
]
...
@@ -415,12 +553,123 @@ startDeviceManager(token: number, options?: ContinuationExtraParams): Promise\<v
...
@@ -415,12 +553,123 @@ startDeviceManager(token: number, options?: ContinuationExtraParams): Promise\<v
});
});
```
```
## continuationManager.updateConnectStatus
## continuationManager.startContinuationDeviceManager<sup>9+</sup>
startContinuationDeviceManager(token: number, callback: AsyncCallback
\<
void>): void;
拉起设备选择模块,可显示组网内可选择设备列表信息,无过滤条件,使用AsyncCallback方式作为异步方法。
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| token | number | 是 | 注册后的token。 |
| callback | AsyncCallback
\<
void> | 是 | AsyncCallback形式返回接口调用结果。 |
**示例:**
```
ts
let
token
=
1
;
try
{
continuationManager
.
startContinuationDeviceManager
(
token
,
(
err
,
data
)
=>
{
if
(
err
.
code
!=
0
)
{
console
.
error
(
'
startContinuationDeviceManager failed, cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
startContinuationDeviceManager finished,
'
+
JSON
.
stringify
(
data
));
});
}
catch
(
err
)
{
console
.
error
(
'
startContinuationDeviceManager failed, cause:
'
+
JSON
.
stringify
(
err
));
}
```
## continuationManager.startContinuationDeviceManager<sup>9+</sup>
startContinuationDeviceManager(token: number, options: ContinuationExtraParams, callback: AsyncCallback
\<
void>): void;
拉起设备选择模块,可显示组网内可选择设备列表信息,使用AsyncCallback方式作为异步方法。
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| token | number | 是 | 注册后的token。 |
| options |
[
ContinuationExtraParams
](
js-apis-continuation-continuationExtraParams.md
)
| 是 | 过滤可选择设备列表的额外参数。 |
| callback | AsyncCallback
\<
void> | 是 | AsyncCallback形式返回接口调用结果。 |
**示例:**
```
ts
let
token
=
1
;
let
continuationExtraParams
=
{
deviceType
:
[
"
00E
"
]
};
try
{
continuationManager
.
startContinuationDeviceManager
(
token
,
continuationExtraParams
,
(
err
,
data
)
=>
{
if
(
err
.
code
!=
0
)
{
console
.
error
(
'
startContinuationDeviceManager failed, cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
startContinuationDeviceManager finished,
'
+
JSON
.
stringify
(
data
));
});
}
catch
(
err
)
{
console
.
error
(
'
startContinuationDeviceManager failed, cause:
'
+
JSON
.
stringify
(
err
));
}
```
## continuationManager.startContinuationDeviceManager<sup>9+</sup>
startContinuationDeviceManager(token: number, options?: ContinuationExtraParams): Promise
\<
void>;
拉起设备选择模块,可显示组网内可选择设备列表信息,使用Promise方式作为异步方法。
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| token | number | 是 | 注册后的token。 |
| options |
[
ContinuationExtraParams
](
js-apis-continuation-continuationExtraParams.md
)
| 否 | 过滤可选择设备列表的额外参数,该参数可缺省|
**返回值:**
| 类型 | 说明 |
| ------------------------- | ------------------ |
| Promise
\<
void> | Promise形式返回接口调用结果。 |
**示例:**
```
ts
let
token
=
1
;
let
continuationExtraParams
=
{
deviceType
:
[
"
00E
"
]
};
try
{
continuationManager
.
startContinuationDeviceManager
(
token
,
continuationExtraParams
)
.
then
((
data
)
=>
{
console
.
info
(
'
startContinuationDeviceManager finished,
'
+
JSON
.
stringify
(
data
));
})
.
catch
((
err
)
=>
{
console
.
error
(
'
startContinuationDeviceManager failed, cause:
'
+
JSON
.
stringify
(
err
));
});
}
catch
(
err
)
{
console
.
error
(
'
startContinuationDeviceManager failed, cause:
'
+
JSON
.
stringify
(
err
));
}
```
## continuationManager.updateConnectStatus<sup>(deprecated)</sup>
updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState, callback: AsyncCallback
\<
void>): void;
updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState, callback: AsyncCallback
\<
void>): void;
通知设备选择模块,更新当前的连接状态,使用AsyncCallback方式作为异步方法。
通知设备选择模块,更新当前的连接状态,使用AsyncCallback方式作为异步方法。
> 从API Version 9开始不再维护,建议使用[updateContinuationState](#continuationmanagerupdatecontinuationstate9)替代。
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**参数:**
**参数:**
...
@@ -434,7 +683,7 @@ updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState,
...
@@ -434,7 +683,7 @@ updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState,
**示例:**
**示例:**
```
j
s
```
t
s
let
token
=
1
;
let
token
=
1
;
let
deviceId
:
string
=
"
test deviceId
"
;
let
deviceId
:
string
=
"
test deviceId
"
;
continuationManager
.
updateConnectStatus
(
token
,
deviceId
,
continuationManager
.
DeviceConnectState
.
CONNECTED
,
(
err
,
data
)
=>
{
continuationManager
.
updateConnectStatus
(
token
,
deviceId
,
continuationManager
.
DeviceConnectState
.
CONNECTED
,
(
err
,
data
)
=>
{
...
@@ -446,12 +695,14 @@ updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState,
...
@@ -446,12 +695,14 @@ updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState,
});
});
```
```
## continuationManager.updateConnectStatus
## continuationManager.updateConnectStatus
<sup>(deprecated)</sup>
updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState): Promise
\<
void>;
updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState): Promise
\<
void>;
通知设备选择模块,更新当前的连接状态,使用Promise方式作为异步方法。
通知设备选择模块,更新当前的连接状态,使用Promise方式作为异步方法。
> 从API Version 9开始不再维护,建议使用[updateContinuationState](#continuationmanagerupdatecontinuationstate9)替代。
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**参数:**
**参数:**
...
@@ -470,7 +721,7 @@ updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState)
...
@@ -470,7 +721,7 @@ updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState)
**示例:**
**示例:**
```
j
s
```
t
s
let
token
=
1
;
let
token
=
1
;
let
deviceId
:
string
=
"
test deviceId
"
;
let
deviceId
:
string
=
"
test deviceId
"
;
continuationManager
.
updateConnectStatus
(
token
,
deviceId
,
continuationManager
.
DeviceConnectState
.
CONNECTED
)
continuationManager
.
updateConnectStatus
(
token
,
deviceId
,
continuationManager
.
DeviceConnectState
.
CONNECTED
)
...
@@ -482,12 +733,90 @@ updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState)
...
@@ -482,12 +733,90 @@ updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState)
});
});
```
```
## continuationManager.unregister
## continuationManager.updateContinuationState<sup>9+</sup>
updateContinuationState(token: number, deviceId: string, status: DeviceConnectState, callback: AsyncCallback
\<
void>): void;
通知设备选择模块,更新当前的连接状态,使用AsyncCallback方式作为异步方法。
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| token | number | 是 | 注册后的token。 |
| deviceId | string | 是 | 设备ID。 |
| status |
[
DeviceConnectState
](
#deviceconnectstate
)
| 是 | 设备连接状态。 |
| callback | AsyncCallback
\<
void> | 是 | AsyncCallback形式返回接口调用结果。 |
**示例:**
```
ts
let
token
=
1
;
let
deviceId
:
string
=
"
test deviceId
"
;
try
{
continuationManager
.
updateContinuationState
(
token
,
deviceId
,
continuationManager
.
DeviceConnectState
.
CONNECTED
,
(
err
,
data
)
=>
{
if
(
err
.
code
!=
0
)
{
console
.
error
(
'
updateContinuationState failed, cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
updateContinuationState finished,
'
+
JSON
.
stringify
(
data
));
});
}
catch
(
err
)
{
console
.
error
(
'
updateContinuationState failed, cause:
'
+
JSON
.
stringify
(
err
));
}
```
## continuationManager.updateContinuationState<sup>9+</sup>
updateContinuationState(token: number, deviceId: string, status: DeviceConnectState): Promise
\<
void>;
通知设备选择模块,更新当前的连接状态,使用Promise方式作为异步方法。
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| token | number | 是 | 注册后的token。 |
| deviceId | string | 是 | 设备ID。 |
| status |
[
DeviceConnectState
](
#deviceconnectstate
)
| 是 | 设备连接状态。 |
**返回值:**
| 类型 | 说明 |
| ------------------------- | ------------------ |
| Promise
\<
void> | Promise形式返回接口调用结果。 |
**示例:**
```
ts
let
token
=
1
;
let
deviceId
:
string
=
"
test deviceId
"
;
try
{
continuationManager
.
updateContinuationState
(
token
,
deviceId
,
continuationManager
.
DeviceConnectState
.
CONNECTED
)
.
then
((
data
)
=>
{
console
.
info
(
'
updateContinuationState finished,
'
+
JSON
.
stringify
(
data
));
})
.
catch
((
err
)
=>
{
console
.
error
(
'
updateContinuationState failed, cause:
'
+
JSON
.
stringify
(
err
));
});
}
catch
(
err
)
{
console
.
error
(
'
updateContinuationState failed, cause:
'
+
JSON
.
stringify
(
err
));
}
```
## continuationManager.unregister<sup>(deprecated)</sup>
unregister(token: number, callback: AsyncCallback
\<
void>): void;
unregister(token: number, callback: AsyncCallback
\<
void>): void;
解注册流转管理服务,传入注册时获取的token进行解注册,使用AsyncCallback方式作为异步方法。
解注册流转管理服务,传入注册时获取的token进行解注册,使用AsyncCallback方式作为异步方法。
> 从API Version 9开始不再维护,建议使用[unregisterContinuation](#continuationmanagerunregistercontinuation9)替代。
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**参数:**
**参数:**
...
@@ -499,7 +828,7 @@ unregister(token: number, callback: AsyncCallback\<void>): void;
...
@@ -499,7 +828,7 @@ unregister(token: number, callback: AsyncCallback\<void>): void;
**示例:**
**示例:**
```
j
s
```
t
s
let
token
=
1
;
let
token
=
1
;
continuationManager
.
unregister
(
token
,
(
err
,
data
)
=>
{
continuationManager
.
unregister
(
token
,
(
err
,
data
)
=>
{
if
(
err
.
code
!=
0
)
{
if
(
err
.
code
!=
0
)
{
...
@@ -510,12 +839,14 @@ unregister(token: number, callback: AsyncCallback\<void>): void;
...
@@ -510,12 +839,14 @@ unregister(token: number, callback: AsyncCallback\<void>): void;
});
});
```
```
## continuationManager.unregister
## continuationManager.unregister
<sup>(deprecated)</sup>
unregister(token: number): Promise
\<
void>;
unregister(token: number): Promise
\<
void>;
解注册流转管理服务,传入注册时获取的token进行解注册,使用Promise方式作为异步方法。
解注册流转管理服务,传入注册时获取的token进行解注册,使用Promise方式作为异步方法。
> 从API Version 9开始不再维护,建议使用[unregisterContinuation](#continuationmanagerunregistercontinuation9)替代。
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**参数:**
**参数:**
...
@@ -532,7 +863,7 @@ unregister(token: number): Promise\<void>;
...
@@ -532,7 +863,7 @@ unregister(token: number): Promise\<void>;
**示例:**
**示例:**
```
j
s
```
t
s
let
token
=
1
;
let
token
=
1
;
continuationManager
.
unregister
(
token
)
continuationManager
.
unregister
(
token
)
.
then
((
data
)
=>
{
.
then
((
data
)
=>
{
...
@@ -543,6 +874,76 @@ unregister(token: number): Promise\<void>;
...
@@ -543,6 +874,76 @@ unregister(token: number): Promise\<void>;
});
});
```
```
## continuationManager.unregisterContinuation<sup>9+</sup>
unregisterContinuation(token: number, callback: AsyncCallback
\<
void>): void;
解注册流转管理服务,传入注册时获取的token进行解注册,使用AsyncCallback方式作为异步方法。
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| token | number | 是 | 注册后的token。 |
| callback | AsyncCallback
\<
void> | 是 | AsyncCallback形式返回接口调用结果。 |
**示例:**
```
ts
let
token
=
1
;
try
{
continuationManager
.
unregisterContinuation
(
token
,
(
err
,
data
)
=>
{
if
(
err
.
code
!=
0
)
{
console
.
error
(
'
unregisterContinuation failed, cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
console
.
info
(
'
unregisterContinuation finished,
'
+
JSON
.
stringify
(
data
));
});
}
catch
(
err
)
{
console
.
error
(
'
unregisterContinuation failed, cause:
'
+
JSON
.
stringify
(
err
));
}
```
## continuationManager.unregisterContinuation<sup>9+</sup>
unregisterContinuation(token: number): Promise
\<
void>;
解注册流转管理服务,传入注册时获取的token进行解注册,使用Promise方式作为异步方法。
**系统能力**
:SystemCapability.Ability.DistributedAbilityManager
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| token | number | 是 | 注册后的token。 |
**返回值:**
| 类型 | 说明 |
| ------------------------- | ------------------ |
| Promise
\<
void> | Promise形式返回接口调用结果。 |
**示例:**
```
ts
let
token
=
1
;
try
{
continuationManager
.
unregisterContinuation
(
token
)
.
then
((
data
)
=>
{
console
.
info
(
'
unregisterContinuation finished,
'
+
JSON
.
stringify
(
data
));
})
.
catch
((
err
)
=>
{
console
.
error
(
'
unregisterContinuation failed, cause:
'
+
JSON
.
stringify
(
err
));
});
}
catch
(
err
)
{
console
.
error
(
'
unregisterContinuation failed, cause:
'
+
JSON
.
stringify
(
err
));
}
```
## DeviceConnectState
## DeviceConnectState
设备连接状态。
设备连接状态。
...
...
zh-cn/application-dev/reference/errorcodes/errcode-DistributedSchedule.md
0 → 100644
浏览文件 @
6e276581
# DistributedSchedule错误码
## 201 权限校验失败
### 错误信息
Permission denied.
### 可能原因
该错误码表示权限校验失败,可能原因是未配置对应权限。
### 处理步骤
配置权限ohos.permission.MANAGER_MISSIONS或ohos.permission.DISTRIBUTED_DATASYNC。
## 401 参数检查错误
### 错误信息
The parameter check failed.
### 可能原因
该错误码表示入参检查错误,可能原因是callback入参检查错误。
### 处理步骤
检查入参callback是否为合法值。
## 16600001 系统服务工作异常
### 错误信息
The system ability work abnormally.
### 可能原因
该错误码表示系统服务工作异常,可能原因如下。
1.
DMS服务没有正常启动。
2.
DMS的binder对象无法正常获取。
3.
流转依赖的其他服务没有正常启动或者binder对象无法获取。
### 处理步骤
系统服务内部工作异常,请稍后重试,或者重启设备尝试。
## 16600002 指定的token或callback未注册
### 错误信息
The specified token or callback has not registered.
### 可能原因
该错误码可能原因是指定的token或callback未注册。
### 处理步骤
请先注册token或callback。
## 16600003 应用注册token已达到最大次数限制
### 错误信息
The number of token registration times has reached the upper limit.
### 可能原因
该错误码可能原因是应用注册token已达到最大次数限制。
### 处理步骤
请勿频繁注册,请使用已注册的token。
## 16600004 指定的callback已注册
### 错误信息
The specified callback has been registered.
### 可能原因
该错误码表示指定的callback已注册,可能原因是使用相同的callback重复注册。
### 处理步骤
请勿使用相同的callback重复注册。
## 16300501 系统服务工作异常
### 错误信息
The system ability work abnormally.
### 可能原因
该错误码表示系统服务工作异常,可能原因如下。
1.
DMS服务没有正常启动。
2.
DMS的binder对象无法正常获取。
3.
流转依赖的其他服务没有正常启动或者binder对象无法获取。
### 处理步骤
系统服务内部工作异常,请稍后重试,或者重启设备尝试。
## 16300502 获取指定的missionId的missionInfo失败
### 错误信息
Failed to get the missionInfo of the specified missionId.
### 可能原因
该错误码表示获取指定的missionId的missionInfo失败,可能原因如下。
1.
missionId输入错误。
2.
missionId对应的missionInfo确实不存在。
### 处理步骤
请检查输入的missionId是否正确。
## 16300503 远端未安装应用且不支持免安装
### 错误信息
The application is not installed on the remote end and installation-free is not supported.
### 可能原因
该错误码可能原因是远端未安装迁移应用并且不支持免安装。
### 处理步骤
1.
请检查远端是否已安装需要迁移的应用。
2.
请检查远端是否支持免安装。
## 16300504 远端未安装应用但支持免安装,需使用免安装标识重试
### 错误信息
The application is not installed on the remote end but installation-free is supported, try again with freeInstall flag.
### 可能原因
该错误码可能原因是远端未安装应用但支持免安装,使用时未使用免安装的标识。
### 处理步骤
请使用免安装的标识重试。
## 16300505 操作设备必须是迁移的应用所在的设备或需迁移到的目标设备
### 错误信息
The operation device must be the device where the application to be continued is located or the target device to be continued.
### 可能原因
该错误码可能原因是操作设备不是迁移的应用所在的设备或需迁移到的目标设备。
### 处理步骤
请检查操作设备是否是迁移的应用所在的设备或需迁移到的目标设备。
## 16300506 本地迁移任务已在进行中
### 错误信息
The local continuation task is already in progress.
### 可能原因
该错误码表示本地迁移任务已在进行中,可能原因是已经发起了迁移任务还未结束。
### 处理步骤
请检查是否已经发起了迁移并未结束。
## 3 序列化对象失败
### 错误信息
Failed to flatten the object.
### 可能原因
该错误码表示对象序列化过程中出现错误,可能原因是系统参数DMS_PROXY_INTERFACE_TOKEN序列化写失败。
### 处理步骤
请检查系统功能是否正常或者重启。
## 7 空对象
### 错误信息
The object is null.
### 可能原因
该错误码表示接口依赖的服务对象或参数对象为空,可能原因如下。
1.
入参序列化读失败。
2.
DMS服务没有正常启动或binder对象无法正常获取。
3.
DMS依赖的其他服务没有正常启动或者binder对象无法获取。
### 处理步骤
1.
检查入参是否为有效合法值。
2.
检查DMS服务是否正常启动,重新启动服务或重启设备。
3.
检查DMS依赖的其他服务是否正常启动,重新启动服务或重启设备。
## 29360207 注册超出最大次数
### 错误信息
The maximum number of registrations exceeded.
### 可能原因
该错误码可能原因是设备频繁注册,次数超出最大次数限制。
### 处理步骤
重启服务并且避免频繁注册。
## 29360208 token未注册
### 错误信息
The token has not registered.
### 可能原因
该错误码可能原因是未注册token。
### 处理步骤
注册token并使用已注册的token。
## 29360209 callback已注册
### 错误信息
Callback has been registered.
### 可能原因
该错误码能原因是指定的callback已经注册过。
### 处理步骤
请勿使用相同的callback重复注册。
## 29360210 callback未注册
### 错误信息
Callback has not been registered.
### 可能原因
该错误码可能原因是指定的callback未注册。
### 处理步骤
注册callback并使用已注册的callback。
## 29360211 连接ability失败
### 错误信息
Failed to connect ability.
### 可能原因
该错误码可能原因是指定token连接ability失败。
### 处理步骤
检查token是否有效以及相应ability是否正常服务,重新启动服务或重启设备。
## 29360214 callback类型错误
### 错误信息
The type of callback is not supported.
### 可能原因
该错误码表示callback类型错误,可能原因是不支持传入的callback类型。
### 处理步骤
请使用系统支持的callback类型并传入。
## 29360215 无效的连接状态
### 错误信息
Invalid continuation mode.
### 可能原因
该错误码表示无效的连接状态,可能原因是入参DeviceConnectState为非指定值。
### 处理步骤
设置指定合法的DeviceConnectState值。
## 29360216 无效的流转模式
### 错误信息
Invalid continuation mode.
### 可能原因
该错误码可能原因是入参ContinuationExtraParams.continuationMode为非指定值。
### 处理步骤
设置指定合法的ContinuationExtraParams.continuationMode值。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录