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 #ifndef OHOS_ABILITY_RUNTIME_ABILITY_CONNECT_CALLBACK_INTERFACE_H 17 #define OHOS_ABILITY_RUNTIME_ABILITY_CONNECT_CALLBACK_INTERFACE_H 18 19 #include "want.h" 20 #include "element_name.h" 21 22 #include "iremote_broker.h" 23 24 namespace OHOS { 25 namespace AAFwk { 26 /** 27 * @class IAbilityConnection 28 * IAbilityConnection is used to notify caller ability that connect or disconnect is complete. 29 */ 30 class IAbilityConnection : public OHOS::IRemoteBroker { 31 public: 32 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.abilityshell.DistributedConnection"); 33 34 /** 35 * OnAbilityConnectDone, AbilityMs notify caller ability the result of connect. 36 * 37 * @param element, service ability's ElementName. 38 * @param remoteObject,.the session proxy of service ability. 39 * @param resultCode, ERR_OK on success, others on failure. 40 */ 41 virtual void OnAbilityConnectDone( 42 const AppExecFwk::ElementName &element, const sptr<IRemoteObject> &remoteObject, int resultCode) = 0; 43 44 /** 45 * OnAbilityDisconnectDone, AbilityMs notify caller ability the result of disconnect. 46 * 47 * @param element, service ability's ElementName. 48 * @param resultCode, ERR_OK on success, others on failure. 49 */ 50 virtual void OnAbilityDisconnectDone(const AppExecFwk::ElementName &element, int resultCode) = 0; 51 52 enum { 53 // ipc id for OnAbilityConnectDone 54 ON_ABILITY_CONNECT_DONE = 1, 55 56 // ipc id for OnAbilityDisConnectDone 57 ON_ABILITY_DISCONNECT_DONE, 58 59 ON_REMOTE_STATE_CHANGED 60 }; 61 }; 62 } // namespace AAFwk 63 } // namespace OHOS 64 #endif // OHOS_ABILITY_RUNTIME_ABILITY_CONNECT_CALLBACK_INTERFACE_H 65