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 #ifndef OHOS_FORM_FWK_FORM_CALLBACK_INTERFACE_H 16 #define OHOS_FORM_FWK_FORM_CALLBACK_INTERFACE_H 17 18 #include "form_js_info.h" 19 #include "form_state_info.h" 20 21 namespace OHOS { 22 namespace AppExecFwk { 23 class FormCallbackInterface { 24 public: 25 /** 26 * @brief Update form. 27 * 28 * @param formJsInfo Indicates the obtained {@code FormJsInfo} instance. 29 */ 30 virtual void ProcessFormUpdate(const FormJsInfo &formJsInfo) = 0; 31 32 /** 33 * @brief Uninstall form. 34 * 35 * @param formId Indicates the ID of the form to uninstall. 36 */ 37 virtual void ProcessFormUninstall(const int64_t formId) = 0; 38 39 /** 40 * @brief Form service death event. 41 * 42 */ 43 virtual void OnDeathReceived() = 0; 44 45 /** 46 * @brief Return error. 47 * 48 * @param errorCode Indicates error-code of the form. 49 * @param errorMsg Indicates error-message of the form. 50 */ 51 virtual void OnError(const int32_t errorCode, const std::string &errorMsg) = 0; 52 53 /** 54 * @brief Recycle form. 55 */ ProcessRecycleForm()56 virtual void ProcessRecycleForm() {} 57 }; 58 59 class FormStateCallbackInterface { 60 public: 61 /** 62 * @brief acquire form state. 63 * 64 * @param state Indicates the form state. 65 */ 66 virtual void ProcessAcquireState(FormState state) = 0; 67 }; 68 69 class FormDataCallbackInterface { 70 public: 71 /** 72 * @brief acquire form data. 73 * 74 * @param state Indicates the form data. 75 */ 76 virtual void ProcessAcquireFormData(AAFwk::WantParams data) = 0; 77 }; 78 79 class ShareFormCallBack { 80 public: 81 /** 82 * @brief share form callback. 83 * 84 * @param result Indicates the result for ShareForm. 85 */ 86 virtual void ProcessShareFormResponse(int32_t result) = 0; 87 }; 88 } // namespace AppExecFwk 89 } // namespace OHOS 90 #endif // OHOS_FORM_FWK_FORM_CALLBACK_INTERFACE_H 91