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_RENDER_INTERFACE_H 17 #define OHOS_FORM_FWK_FORM_RENDER_INTERFACE_H 18 19 #include <vector> 20 21 #include "form_js_info.h" 22 #include "ipc_types.h" 23 #include "iremote_broker.h" 24 #include "want.h" 25 26 namespace OHOS { 27 namespace AppExecFwk { 28 using OHOS::AAFwk::Want; 29 /** 30 * @class IFormProvider 31 * IFormProvider interface is used to access form render service. 32 */ 33 class IFormRender : public IRemoteBroker { 34 public: 35 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.FormRender"); 36 37 /** 38 * @brief Render form. This is a sync API. 39 * @param formJsInfo The form js info. 40 * @param want Indicates the {@link Want} structure containing form info. 41 * @param callerToken Caller ability token. 42 * @return Returns ERR_OK on success, others on failure. 43 */ 44 virtual int32_t RenderForm(const FormJsInfo &formJsInfo, const Want &want, 45 const sptr<IRemoteObject> &callerToken) = 0; 46 47 /** 48 * @brief Stop rendering form. This is sync API. 49 * @param formId Indicates The Id of the form to stop rendering. 50 * @param want Indicates the {@link Want} structure containing form info. 51 * @param callerToken Caller ability token. 52 * @return Returns ERR_OK on success, others on failure. 53 */ 54 virtual int32_t StopRenderingForm(const FormJsInfo &formJsInfo, const Want &want, const sptr<IRemoteObject> &callerToken) = 0; 55 56 /** 57 * @brief When host is died, clean resources. This is async API. 58 * @param hostToken Caller ability token. 59 * @return Returns ERR_OK on success, others on failure. 60 */ 61 virtual int32_t CleanFormHost(const sptr<IRemoteObject> &hostToken) = 0; 62 ReloadForm(const std::vector<int64_t> && formIds,const Want & want)63 virtual int32_t ReloadForm(const std::vector<int64_t> &&formIds, const Want &want) { return ERR_OK; } 64 65 enum class Message { 66 // ipc id 1-1000 for kit 67 // ipc id 1001-2000 for DMS 68 // ipc id 2001-3000 for tools 69 // ipc id for form mgr (3001) 70 // ipc id for form provider (3051) 71 // ipc id for form render (3101) 72 // ipc id for form supply (3201) 73 // ipc id for form host (3681) 74 75 FORM_RENDER_RENDER_FORM = 3101, 76 FORM_RENDER_STOP_RENDERING_FORM = 3102, 77 FORM_RENDER_FORM_HOST_DIED = 3103, 78 FORM_RENDER_RELOAD_FORM = 3104, 79 }; 80 }; 81 } // namespace AppExecFwk 82 } // namespace OHOS 83 84 #endif // OHOS_FORM_FWK_FORM_RENDER_INTERFACE_H 85