1/* 2 * Copyright (c) 2021-2023 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 16/** 17 * @file 18 * @kit AbilityKit 19 */ 20 21import { ElementName } from '../bundleManager/ElementName'; 22import rpc from './../@ohos.rpc'; 23 24/** 25 * As an input parameter when connecting a specified background service, it is used to receive 26 * state changes during the connection. 27 * 28 * @interface ConnectOptions 29 * @syscap SystemCapability.Ability.AbilityRuntime.Core 30 * @since 7 31 */ 32export interface ConnectOptions { 33 /** 34 * The callback interface was connect successfully. 35 * 36 * @param { ElementName } elementName - The element name of the service ability 37 * @param { rpc.IRemoteObject } remote - The remote object instance 38 * @syscap SystemCapability.Ability.AbilityRuntime.Core 39 * @since 7 40 */ 41 /** 42 * The callback interface was connect successfully. 43 * 44 * @param { ElementName } elementName - The ohos.bundleManager.ElementName object of the service ability 45 * @param { rpc.IRemoteObject } remote - The remote object instance 46 * @syscap SystemCapability.Ability.AbilityRuntime.Core 47 * @since 12 48 */ 49 onConnect(elementName: ElementName, remote: rpc.IRemoteObject): void; 50 51 /** 52 * The callback interface was disconnect successfully. 53 * 54 * @param { ElementName } elementName - The element name of the service ability 55 * @syscap SystemCapability.Ability.AbilityRuntime.Core 56 * @since 7 57 */ 58 /** 59 * The callback interface was disconnect successfully. 60 * 61 * @param { ElementName } elementName - The ohos.bundleManager.ElementName object of the service ability 62 * @syscap SystemCapability.Ability.AbilityRuntime.Core 63 * @since 12 64 */ 65 onDisconnect(elementName: ElementName): void; 66 67 /** 68 * The callback interface was connect failed. 69 * 70 * @param { number } code - The error code of the failed. 71 * @syscap SystemCapability.Ability.AbilityRuntime.Core 72 * @since 7 73 */ 74 onFailed(code: number): void; 75} 76