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 #ifndef OHOS_FORM_FWK_FORM_ACQUIRE_DATA_CONNECTION_H
17 #define OHOS_FORM_FWK_FORM_ACQUIRE_DATA_CONNECTION_H
18 
19 #include "event_handler.h"
20 #include "form_ability_connection.h"
21 #include "want.h"
22 
23 namespace OHOS {
24 namespace AppExecFwk {
25 using WantParams = OHOS::AAFwk::WantParams;
26 using Want = OHOS::AAFwk::Want;
27 
28 /**
29  * @class FormAcquireDataConnection
30  * Form acquire data connection stub.
31  */
32 class FormAcquireDataConnection : public FormAbilityConnection {
33 public:
34     FormAcquireDataConnection(int64_t formId, const std::string &bundleName, const std::string &abilityName,
35        int64_t formRequestCode);
36 
37     virtual ~FormAcquireDataConnection() = default;
38 
39     /**
40      * @brief OnAbilityConnectDone, AbilityMs notify caller ability the result of connect.
41      * @param element service ability's ElementName.
42      * @param remoteObject The session proxy of service ability.
43      * @param resultCode ERR_OK on success, others on failure.
44      */
45     void OnAbilityConnectDone(
46         const AppExecFwk::ElementName &element, const sptr<IRemoteObject> &remoteObject, int resultCode) override;
47 
48 private:
49     int64_t formRequestCode_ {0};
50     DISALLOW_COPY_AND_MOVE(FormAcquireDataConnection);
51 };
52 } // namespace AppExecFwk
53 } // namespace OHOS
54 #endif // OHOS_FORM_FWK_FORM_FORM_ACQUIRE_DATA_CONNECTION_H
55