1/* 2 * Copyright (c) 2021-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 { ElementName } from '../bundle/elementName'; 17import rpc from './../@ohos.rpc'; 18 19/** 20 * @since 7 21 * @syscap SystemCapability.Ability.AbilityRuntime.Core 22 * @permission N/A 23 */ 24export interface ConnectOptions { 25 /** 26 * The callback interface was connect successfully. 27 * 28 * @default - 29 * @since 7 30 * @syscap SystemCapability.Ability.AbilityRuntime.Core 31 * @param elementName The element name of the service ability 32 * @param remote The remote object instance 33 */ 34 onConnect(elementName: ElementName, remote: rpc.IRemoteObject): void; 35 36 /** 37 * The callback interface was disconnect successfully. 38 * 39 * @default - 40 * @since 7 41 * @syscap SystemCapability.Ability.AbilityRuntime.Core 42 * @param elementName The element name of the service ability 43 */ 44 onDisconnect(elementName: ElementName): void; 45 46 /** 47 * The callback interface was connect failed. 48 * 49 * @default - 50 * @since 7 51 * @syscap SystemCapability.Ability.AbilityRuntime.Core 52 * @param code The error code of the failed. 53 */ 54 onFailed(code: number): void; 55} 56