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