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 16 #ifndef OHOS_ABILITY_RUNTIME_ABILITY_CONNECT_CALLBACK_H 17 #define OHOS_ABILITY_RUNTIME_ABILITY_CONNECT_CALLBACK_H 18 19 #include "element_name.h" 20 21 #include "iremote_broker.h" 22 #include "refbase.h" 23 24 namespace OHOS { 25 namespace AbilityRuntime { 26 /** 27 * @class AbilityConnectCallback 28 * AbilityConnectCallback is used to notify caller ability that connect or disconnect is complete. 29 */ 30 class AbilityConnectCallback : public RefBase { 31 public: 32 /** 33 * @brief Constructor. 34 * 35 */ 36 AbilityConnectCallback() = default; 37 38 /** 39 * @brief Destructor. 40 * 41 */ 42 virtual ~AbilityConnectCallback() = default; 43 44 /** 45 * OnConnect, AbilityMs notify caller ability the result of connect. 46 * 47 * @param element, service ability's ElementName. 48 * @param remoteObject, ipc proxy from remote 49 * @param resultCode, ERR_OK on success, others on failure. 50 */ 51 virtual void OnAbilityConnectDone(const AppExecFwk::ElementName &element, 52 const sptr<IRemoteObject> &remoteObject, int resultCode) = 0; 53 54 /** 55 * OnDisconnect, AbilityMs notify caller ability the result of disconnect. 56 * 57 * @param element, service ability's ElementName. 58 * @param resultCode, ERR_OK on success, others on failure. 59 */ 60 virtual void OnAbilityDisconnectDone(const AppExecFwk::ElementName &element, int resultCode) = 0; 61 }; 62 } // namespace AbilityRuntime 63 } // namespace OHOS 64 #endif // OHOS_ABILITY_RUNTIME_ABILITY_CONNECT_CALLBACK_H 65