• 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_INTERFACE_H
17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_FORMMGR_FORM_HOST_INTERFACE_H
18 
19 #include <vector>
20 
21 #include "form_js_info.h"
22 #include "form_state_info.h"
23 #include "ipc_types.h"
24 #include "iremote_broker.h"
25 
26 namespace OHOS {
27 namespace AppExecFwk {
28 /**
29  * @class IFormHost
30  * IFormHost interface is used to access form host service.
31  */
32 class IFormHost : public OHOS::IRemoteBroker {
33 public:
34     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.FormHost");
35 
36     /**
37      * @brief Request to give back a Form.
38      * @param formInfo Form info.
39      */
40     virtual void OnAcquired(const FormJsInfo &formInfo) = 0;
41 
42      /**
43      * @brief Form is updated.
44      * @param formInfo Form info.
45      */
46     virtual void OnUpdate(const FormJsInfo &formInfo) = 0;
47 
48     /**
49      * @brief Form provider is uninstalled.
50      * @param formIds The Id list of the forms.
51      */
52     virtual void OnUninstall(const std::vector<int64_t> &formIds) = 0;
53 
54     /**
55      * @brief Form provider is acquire state
56      * @param state The form state.
57      * @param want The form want.
58      */
59     virtual void OnAcquireState(AppExecFwk::FormState state, const AAFwk::Want &want) = 0;
60 
61     enum class Message {
62         // ipc id 1-1000 for kit
63         // ipc id 1001-2000 for DMS
64         // ipc id 2001-3000 for tools
65         // ipc id for create (3001)
66         FORM_HOST_ON_ACQUIRED = 3681,
67 
68         // ipc id for update (3682)
69         FORM_HOST_ON_UPDATE,
70 
71         // ipc id for uninstall (3683)
72         FORM_HOST_ON_UNINSTALL,
73 
74         // ipc id for uninstall (3684)
75         FORM_HOST_ON_ACQUIRE_FORM_STATE,
76     };
77 };
78 }  // namespace AppExecFwk
79 }  // namespace OHOS
80 
81 #endif // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_FORMMGR_FORM_HOST_INTERFACE_H
82