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