• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 ABILITY_RUNTIME_ABILITY_CONNECT_CALLBACK_H
17 #define 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      * OnConnect, AbilityMs notify caller ability the result of connect.
45      *
46      * @param element, service ability's ElementName.
47      * @param resultCode, ERR_OK on success, others on failure.
48      */
49     virtual void OnAbilityConnectDone(const AppExecFwk::ElementName &element,
50                            const sptr<IRemoteObject> &remoteObject, int resultCode) = 0;
51 
52     /**
53      * OnDisconnect, AbilityMs notify caller ability the result of disconnect.
54      *
55      * @param element, service ability's ElementName.
56      * @param resultCode, ERR_OK on success, others on failure.
57      */
58     virtual void OnAbilityDisconnectDone(const AppExecFwk::ElementName &element, int resultCode) = 0;
59 };
60 }  // namespace AbilityRuntime
61 }  // namespace OHOS
62 #endif  // ABILITY_RUNTIME_ABILITY_CONNECT_CALLBACK_H