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_FORM_FWK_FORM_HOST_STUB_H
17 #define OHOS_FORM_FWK_FORM_HOST_STUB_H
18 
19 #include <map>
20 
21 #include "form_host_interface.h"
22 #include "iremote_object.h"
23 #include "iremote_stub.h"
24 
25 namespace OHOS {
26 namespace AppExecFwk {
27 /**
28  * @class FormHostStub
29  * Form host service stub.
30  */
31 class FormHostStub : public IRemoteStub<IFormHost> {
32 public:
33     FormHostStub();
34     virtual ~FormHostStub();
35     /**
36      * @brief handle remote request.
37      * @param data input param.
38      * @param reply output param.
39      * @param option message option.
40      * @return Returns ERR_OK on success, others on failure.
41      */
42     virtual int OnRemoteRequest(
43         uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option);
44 
45 private:
46     /**
47      * @brief handle OnAcquired message.
48      * @param data input param.
49      * @param reply output param.
50      * @return Returns ERR_OK on success, others on failure.
51      */
52     int HandleAcquired(MessageParcel &data, MessageParcel &reply);
53     /**
54      * @brief handle OnUpdate message.
55      * @param data input param.
56      * @param reply output param.
57      * @return Returns ERR_OK on success, others on failure.
58      */
59     int HandleOnUpdate(MessageParcel &data, MessageParcel &reply);
60     /**
61      * @brief handle OnUnInstall message.
62      * @param data input param.
63      * @param reply output param.
64      * @return Returns ERR_OK on success, others on failure.
65      */
66     int HandleOnUninstall(MessageParcel &data, MessageParcel &reply);
67 
68     /**
69      * @brief handle OnAcquireState message.
70      * @param data input param.
71      * @param reply output param.
72      * @return Returns ERR_OK on success, others on failure.
73      */
74     int HandleOnAcquireState(MessageParcel &data, MessageParcel &reply);
75 
76     /**
77      * @brief handle OnShareFormResponse message.
78      * @param data input param.
79      * @param reply output param.
80      * @return Returns ERR_OK on success, others on failure.
81      */
82     int32_t HandleOnShareFormResponse(MessageParcel &data, MessageParcel &reply);
83 
84     /**
85      * @brief handle OnError message.
86      * @param data input param.
87      * @param reply output param.
88      * @return Returns ERR_OK on success, others on failure.
89      */
90     int32_t HandleOnError(MessageParcel &data, MessageParcel &reply);
91 
92     /**
93      * @brief handle OnError message.
94      * @param data input param.
95      * @param reply output param.
96      * @return Returns ERR_OK on success, others on failure.
97      */
98     int32_t HandleOnErrorForms(MessageParcel &data, MessageParcel &reply);
99 
100     /**
101      * @brief handle OnAcquireDataResponse message.
102      * @param data input param.
103      * @param reply output param.
104      * @return Returns ERR_OK on success, others on failure.
105      */
106     int32_t HandleOnAcquireDataResponse(MessageParcel &data, MessageParcel &reply);
107 
108     /**
109      * @brief handle OnRecycleForm message.
110      * @param data input param.
111      * @param reply output param.
112      * @return Returns ERR_OK on success, others on failure.
113      */
114     int32_t HandleOnRecycleForm(MessageParcel &data, MessageParcel &reply);
115 
116     /**
117      * @brief handle OnEnableForm message.
118      * @param data input param.
119      * @param reply output param.
120      * @return Returns ERR_OK on success, others on failure.
121      */
122     int32_t HandleOnEnableForm(MessageParcel &data, MessageParcel &reply);
123 private:
124     DISALLOW_COPY_AND_MOVE(FormHostStub);
125 };
126 }  // namespace AppExecFwk
127 }  // namespace OHOS
128 #endif  // OHOS_FORM_FWK_FORM_HOST_STUB_H
129