1 /* 2 * Copyright (c) 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 #ifndef OHOS_ABILITY_RUNTIME_ABILITY_BACKGROUND_CONNECTION_H 18 #define OHOS_ABILITY_RUNTIME_ABILITY_BACKGROUND_CONNECTION_H 19 20 #include "ability_connect_callback_interface.h" 21 #include "iremote_object.h" 22 #include "iremote_stub.h" 23 #include "nocopyable.h" 24 25 namespace OHOS { 26 namespace AAFwk { 27 /** 28 * @class AbilityBackgroundConnection 29 * Ability Background Connection Stub. 30 */ 31 class AbilityBackgroundConnection : public IRemoteStub<IAbilityConnection> { 32 public: 33 AbilityBackgroundConnection() = default; 34 virtual ~AbilityBackgroundConnection() = default; 35 36 /** 37 * @brief OnAbilityConnectDone, AbilityMs notify caller ability the result of connect. 38 * @param element service ability's ElementName. 39 * @param remoteObject the session proxy of service ability. 40 * @param resultCode ERR_OK on success, others on failure. 41 */ 42 void OnAbilityConnectDone( 43 const AppExecFwk::ElementName &element, const sptr<IRemoteObject> &remoteObject, int resultCode) override; 44 45 /** 46 * OnAbilityDisconnectDone, AbilityMs notify caller ability the result of disconnect. 47 * 48 * @param element, service ability's ElementName. 49 * @param resultCode, ERR_OK on success, others on failure. 50 */ 51 void OnAbilityDisconnectDone(const AppExecFwk::ElementName &element, int resultCode) override; 52 53 private: 54 DISALLOW_COPY_AND_MOVE(AbilityBackgroundConnection); 55 }; 56 } // namespace AppExecFwk 57 } // namespace OHOS 58 59 #endif // ABILITY_BACKGROUND_CONNECTION_H 60