• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import { AsyncCallback } from './basic';
17import { ContinueCallback } from './application/ContinueCallback';
18import { ContinueDeviceInfo } from './application/ContinueDeviceInfo';
19import { MissionCallback } from './application/MissionCallbacks';
20import { MissionDeviceInfo } from './application/MissionDeviceInfo';
21import { MissionParameter } from './application/MissionParameter';
22
23/**
24 * This module provides the capability to manage abilities and obtain system task information for distributed
25 * scenario.
26 * @namespace distributedMissionManager
27 * @syscap SystemCapability.Ability.AbilityRuntime.Mission
28 * @systemapi Hide this for inner system use.
29 * @since 9
30 */
31declare namespace distributedMissionManager {
32  /**
33   * Start sync missions from remote device.
34   *
35   * @permission ohos.permission.MANAGE_MISSIONS
36   * @param parameter Parameters corresponding to mission.
37   * @throws { BusinessError } 201 - Permission denied.
38   * @throws { BusinessError } 401 - The parameter check failed.
39   * @syscap SystemCapability.Ability.AbilityRuntime.Mission
40   * @systemapi Hide this for inner system use.
41   * @since 9
42   */
43  function startSyncRemoteMissions(parameter: MissionParameter, callback: AsyncCallback<void>): void;
44  function startSyncRemoteMissions(parameter: MissionParameter): Promise<void>;
45
46  /**
47   * Stop sync missions from remote device.
48   *
49   * @permission ohos.permission.MANAGE_MISSIONS
50   * @param parameter Parameters corresponding to mission.
51   * @throws { BusinessError } 201 - Permission denied.
52   * @throws { BusinessError } 401 - The parameter check failed.
53   * @syscap SystemCapability.Ability.AbilityRuntime.Mission
54   * @systemapi Hide this for inner system use.
55   * @since 9
56   */
57  function stopSyncRemoteMissions(parameter: MissionDeviceInfo, callback: AsyncCallback<void>): void;
58  function stopSyncRemoteMissions(parameter: MissionDeviceInfo): Promise<void>;
59
60  /**
61   * Register the missionListener to ams.
62   *
63   * @permission ohos.permission.MANAGE_MISSIONS
64   * @param parameter Parameters corresponding to mission.
65   * @param options The callbacks for registering mission.
66   * @throws { BusinessError } 201 - Permission denied.
67   * @throws { BusinessError } 401 - The parameter check failed.
68   * @syscap SystemCapability.Ability.AbilityRuntime.Mission
69   * @systemapi Hide this for inner system use.
70   * @since 9
71   */
72  function registerMissionListener(parameter: MissionDeviceInfo, options: MissionCallback, callback: AsyncCallback<void>): void;
73  function registerMissionListener(parameter: MissionDeviceInfo, options: MissionCallback): Promise<void>;
74
75  /**
76   * Unregister the missionListener to ams.
77   *
78   * @permission ohos.permission.MANAGE_MISSIONS
79   * @param parameter Parameters corresponding to mission.
80   * @throws { BusinessError } 201 - Permission denied.
81   * @throws { BusinessError } 401 - The parameter check failed.
82   * @syscap SystemCapability.Ability.AbilityRuntime.Mission
83   * @systemapi Hide this for inner system use.
84   * @since 9
85   */
86  function unRegisterMissionListener(parameter: MissionDeviceInfo, callback: AsyncCallback<void>): void;
87  function unRegisterMissionListener(parameter: MissionDeviceInfo): Promise<void>;
88
89  /**
90   * Continue mission
91   *
92   * @permission ohos.permission.MANAGE_MISSIONS and ohos.permission.DISTRIBUTED_DATASYNC
93   * @param parameter Parameters corresponding to continue mission.
94   * @throws { BusinessError } 201 - Permission denied.
95   * @throws { BusinessError } 401 - The parameter check failed.
96   * @throws { BusinessError } 16300501 - The system ability work abnormally.
97   * @throws { BusinessError } 16300502 - Failed to get the missionInfo of the specified missionId.
98   * @throws { BusinessError } 16300503 - The application is not installed on the remote end and installation-free is
99   * not supported.
100   * @throws { BusinessError } 16300504 - The application is not installed on the remote end but installation-free is
101   * supported, try again with freeInstall flag.
102   * @throws { BusinessError } 16300505 - The operation device must be the device where the application to be continued
103   * is located or the target device to be continued.
104   * @throws { BusinessError } 16300506 - The local continuation task is already in progress.
105   * @syscap SystemCapability.Ability.AbilityRuntime.Mission
106   * @systemapi Hide this for inner system use.
107   * @since 9
108   */
109  function continueMission(parameter: ContinueDeviceInfo, options: ContinueCallback, callback: AsyncCallback<void>): void;
110  function continueMission(parameter: ContinueDeviceInfo, options: ContinueCallback): Promise<void>;
111}
112export default distributedMissionManager;
113