• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_FORMMGR_FORM_HOST_STUB_H
17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_FORMMGR_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 private:
76     using FormHostFunc = int32_t (FormHostStub::*)(MessageParcel &data, MessageParcel &reply);
77     std::map<uint32_t, FormHostFunc> memberFuncMap_;
78 
79     DISALLOW_COPY_AND_MOVE(FormHostStub);
80 };
81 }  // namespace AppExecFwk
82 }  // namespace OHOS
83 #endif  // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_FORMMGR_FORM_HOST_STUB_H
84