• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021 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 */
15import { AsyncCallback } from './basic';
16import { StartAbilityParameter } from './ability/startAbilityParameter';
17import { Want } from './ability/want';
18import { ConnectOptions } from './ability/connectOptions';
19
20/**
21 * A Particle Ability represents an ability with service.
22 * @name particleAbility
23 * @since 7
24 * @sysCap AAFwk
25 * @devices phone, tablet
26 * @permission N/A
27 */
28declare namespace particleAbility {
29
30  /**
31   * Service ability uses this method to start a specific ability.
32   * @devices phone, tablet
33   * @since 7
34   * @sysCap AAFwk
35   * @param parameter Indicates the ability to start.
36   * @return -
37   */
38  function startAbility(parameter: StartAbilityParameter, callback: AsyncCallback<void>): void;
39  function startAbility(parameter: StartAbilityParameter): Promise<void>;
40
41  /**
42   * Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template.
43   * @default -
44   * @devices phone, tablet
45   * @since 7
46   * @SysCap aafwk
47   * @param request The element name of the service ability
48   * @param options The remote object instance
49   * @return Returns the number of the ability connected
50   */
51   function connectAbility(request: Want, options:ConnectOptions ): number;
52
53   /**
54    * The callback interface was connect successfully.
55    * @default -
56    * @devices phone, tablet
57    * @since 7
58    * @SysCap aafwk
59    * @param connection The number of the ability connected
60    */
61   function disconnectAbility(connection: number, callback:AsyncCallback<void>): void;
62   function disconnectAbility(connection: number): Promise<void>;
63}
64export default particleAbility;