1 /* 2 * Copyright (c) 2024 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_INPUTMETHOD_CONTROLLER_CAPI_H 17 #define OHOS_INPUTMETHOD_CONTROLLER_CAPI_H 18 /** 19 * @addtogroup InputMethod 20 * @{ 21 * 22 * @brief InputMethod provides functions to use input methods and develop input methods. 23 * 24 * @since 12 25 */ 26 27 /** 28 * @file inputmethod_controller_capi.h 29 * 30 * @brief Provides the functions for using input method. 31 * 32 * @library libohinputmethod.so 33 * @kit IMEKit 34 * @syscap SystemCapability.MiscServices.InputMethodFramework 35 * @since 12 36 * @version 1.0 37 */ 38 39 #include <stdint.h> 40 #include <stdlib.h> 41 42 #include "inputmethod_text_editor_proxy_capi.h" 43 #include "inputmethod_inputmethod_proxy_capi.h" 44 #include "inputmethod_attach_options_capi.h" 45 #ifdef __cplusplus 46 extern "C" { 47 #endif /* __cplusplus */ 48 /** 49 * @brief Attach application to the input method service. 50 * 51 * @param textEditorProxy Represents a pointer to an {@link InputMethod_TextEditorProxy} instance. 52 * The caller needs to manage the lifecycle of textEditorProxy. 53 * If the call succeeds, caller cannot release textEditorProxy until the next attach or detach call. 54 * @param options Represents a pointer to an {@link InputMethod_AttachOptions} instance. 55 * The options when attaching input method. 56 * @param inputMethodProxy Represents a pointer to an {@link OH_InputMethod_InputMethodProxy} instance. 57 * Lifecycle is mantianed until the next attach or detach call. 58 * @return Returns a specific error code. 59 * {@link IME_ERR_OK} - success. 60 * {@link IME_ERR_PARAMCHECK} - parameter check failed. 61 * {@link IME_ERR_IMCLIENT} - input method client error. 62 * {@link IME_ERR_IMMS} - input method manager service error. 63 * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. 64 * Specific error codes can be referenced {@link InputMethod_ErrorCode}. 65 * @since 12 66 */ 67 InputMethod_ErrorCode OH_InputMethodController_Attach(InputMethod_TextEditorProxy *textEditorProxy, 68 InputMethod_AttachOptions *options, InputMethod_InputMethodProxy **inputMethodProxy); 69 70 /** 71 * @brief Detach application from the input method service. 72 * 73 * @param inputMethodProxy Represents a pointer to an {@link OH_InputMethod_InputMethodProxy} instance. 74 * The inputMethodProxy is obtained from {@link OH_InputMethodController_Attach}. 75 * @return Returns a specific error code. 76 * {@link IME_ERR_OK} - success. 77 * {@link IME_ERR_IMCLIENT} - input method client error. 78 * {@link IME_ERR_IMMS} - input method manager service error. 79 * {@link IME_ERR_NULL_POINTER} - unexpected null pointer. 80 * Specific error codes can be referenced {@link InputMethod_ErrorCode}. 81 * @since 12 82 */ 83 InputMethod_ErrorCode OH_InputMethodController_Detach(InputMethod_InputMethodProxy *inputMethodProxy); 84 #ifdef __cplusplus 85 } 86 #endif /* __cplusplus */ 87 /** @} */ 88 #endif // OHOS_INPUTMETHOD_CONTROLLER_CAPI_H