inputmethod_inputmethod_proxy_capi.h

Overview

Provides methods for using the input method, allowing requests and notifications to be sent to the input method application.

File to include: <inputmethod/inputmethod_inputmethod_proxy_capi.h>

Library: libohinputmethod.so

System capability: SystemCapability.MiscServices.InputMethodFramework

Since: 12

Related module: InputMethod

Summary

Structs

Name typedef Keyword Description
InputMethod_InputMethodProxy InputMethod_InputMethodProxy Input method proxy object, which can be used to call the method for using the input method.

Function

Name Description
InputMethod_ErrorCode OH_InputMethodProxy_ShowKeyboard(InputMethod_InputMethodProxy *inputMethodProxy) Displays the keyboard.
InputMethod_ErrorCode OH_InputMethodProxy_ShowTextInput(InputMethod_InputMethodProxy *inputMethodProxy, InputMethod_AttachOptions *options) Displays the text box.
InputMethod_ErrorCode OH_InputMethodProxy_HideKeyboard(InputMethod_InputMethodProxy *inputMethodProxy) Hides the keyboard.
InputMethod_ErrorCode OH_InputMethodProxy_NotifySelectionChange(InputMethod_InputMethodProxy *inputMethodProxy, char16_t text[], size_t length, int start, int end) Notifies the input method application of the change in the selected text area, including the change of text content, cursor position, or the selected text.
InputMethod_ErrorCode OH_InputMethodProxy_NotifyConfigurationChange(InputMethod_InputMethodProxy *inputMethodProxy,InputMethod_EnterKeyType enterKey, InputMethod_TextInputType textType) Notifies the change of the text box configuration.
InputMethod_ErrorCode OH_InputMethodProxy_NotifyCursorUpdate(InputMethod_InputMethodProxy *inputMethodProxy, InputMethod_CursorInfo *cursorInfo) Notifies the change of the cursor position.
InputMethod_ErrorCode OH_InputMethodProxy_SendPrivateCommand(InputMethod_InputMethodProxy *inputMethodProxy, InputMethod_PrivateCommand *privateCommand[], size_t size) Sends a private data command.

Function Description

OH_InputMethodProxy_ShowKeyboard()

InputMethod_ErrorCode OH_InputMethodProxy_ShowKeyboard(InputMethod_InputMethodProxy *inputMethodProxy)

Description

Displays the keyboard.

Since: 12

Parameters

Name Description
InputMethod_InputMethodProxy *inputMethodProxy Pointer to the InputMethod_InputMethodProxy instance obtained by calling OH_InputMethodController_Attach.

Returns

Type Description
InputMethod_ErrorCode An error code.
IME_ERR_OK - Success.
IME_ERR_IMCLIENT - Client error in input method.
IME_ERR_IMMS - Input method service error.
IME_ERR_DETACHED - Input method not bound.
IME_ERR_NULL_POINTER - An unexpected null pointer.
For details about the error codes, see InputMethod_ErrorCode.

OH_InputMethodProxy_ShowTextInput()

InputMethod_ErrorCode OH_InputMethodProxy_ShowTextInput(InputMethod_InputMethodProxy *inputMethodProxy, InputMethod_AttachOptions *options)

Description

Displays the text box.

Since: 15

Parameters

Name Description
InputMethod_InputMethodProxy *inputMethodProxy Pointer to the InputMethod_InputMethodProxy instance obtained by calling OH_InputMethodController_Attach.
InputMethod_AttachOptions *options Pointer to the InputMethod_AttachOptions instance, which is used to obtain the configuration options.
In this API, you only need to pay attention to InputMethod_RequestKeyboardReason, which indicates the reason for requesting the keyboard.

Returns

Type Description
InputMethod_ErrorCode An error code.
IME_ERR_OK - Success.
IME_ERR_IMCLIENT - Client error in input method.
IME_ERR_IMMS - Input method service error.
IME_ERR_DETACHED - Input method not bound.
IME_ERR_NULL_POINTER - An unexpected null pointer.
For details about the error codes, see InputMethod_ErrorCode.

OH_InputMethodProxy_HideKeyboard()

InputMethod_ErrorCode OH_InputMethodProxy_HideKeyboard(InputMethod_InputMethodProxy *inputMethodProxy)

Description

Hides the keyboard.

Since: 12

Parameters

Name Description
InputMethod_InputMethodProxy *inputMethodProxy Pointer to the InputMethod_InputMethodProxy instance obtained by calling OH_InputMethodController_Attach.

Returns

Type Description
InputMethod_ErrorCode An error code.
IME_ERR_OK - Success.
IME_ERR_IMCLIENT - Client error in input method.
IME_ERR_IMMS - Input method service error.
IME_ERR_DETACHED - Input method not bound.
IME_ERR_NULL_POINTER - An unexpected null pointer.
For details about the error codes, see InputMethod_ErrorCode.

OH_InputMethodProxy_NotifySelectionChange()

InputMethod_ErrorCode OH_InputMethodProxy_NotifySelectionChange(InputMethod_InputMethodProxy *inputMethodProxy, char16_t text[], size_t length, int start, int end)

Description

Notifies the input method application of the change in the selected text area, including the change of text content, cursor position, or the selected text.

Since: 12

Parameters

Name Description
InputMethod_InputMethodProxy *inputMethodProxy Pointer to the InputMethod_InputMethodProxy instance obtained by calling OH_InputMethodController_Attach.
text Entire input text.
size_t length Length of the text parameter. Maximum length: 8 KB.
int start Start position of the selected text.
int end End position of the selected text.

Returns

Type Description
InputMethod_ErrorCode An error code.
IME_ERR_OK - Success.
IME_ERR_PARAMCHECK - Parameter error.
IME_ERR_IMCLIENT - Client error in input method.
IME_ERR_IMMS - Input method service error.
IME_ERR_DETACHED - Input method not bound.
IME_ERR_NULL_POINTER - An unexpected null pointer.
For details about the error codes, see InputMethod_ErrorCode.

OH_InputMethodProxy_NotifyConfigurationChange()

InputMethod_ErrorCode OH_InputMethodProxy_NotifyConfigurationChange(InputMethod_InputMethodProxy *inputMethodProxy,InputMethod_EnterKeyType enterKey, InputMethod_TextInputType textType)

Description

Notifies the change of the text box configuration.

Since: 12

Parameters

Name Description
InputMethod_InputMethodProxy *inputMethodProxy Pointer to the InputMethod_InputMethodProxy instance obtained by calling OH_InputMethodController_Attach.
InputMethod_EnterKeyType enterKey Enter key type.
InputMethod_TextInputType textType Text box type.

Returns

Type Description
InputMethod_ErrorCode An error code.
IME_ERR_OK - Success.
IME_ERR_PARAMCHECK - Parameter error.
IME_ERR_IMCLIENT - Client error in input method.
IME_ERR_IMMS - Input method service error.
IME_ERR_DETACHED - Input method not bound.
IME_ERR_NULL_POINTER - An unexpected null pointer.
For details about the error codes, see InputMethod_ErrorCode.

OH_InputMethodProxy_NotifyCursorUpdate()

InputMethod_ErrorCode OH_InputMethodProxy_NotifyCursorUpdate(InputMethod_InputMethodProxy *inputMethodProxy, InputMethod_CursorInfo *cursorInfo)

Description

Notifies the cursor position change.

Since: 12

Parameters

Name Description
InputMethod_InputMethodProxy *inputMethodProxy Pointer to the InputMethod_InputMethodProxy instance obtained by calling OH_InputMethodController_Attach.
InputMethod_CursorInfo *cursorInfo Pointer to the InputMethod_CursorInfo instance, indicating the cursor information.

Returns

Type Description
InputMethod_ErrorCode An error code.
IME_ERR_OK - Success.
IME_ERR_PARAMCHECK - Parameter error.
IME_ERR_IMCLIENT - Client error in input method.
IME_ERR_IMMS - Input method service error.
IME_ERR_DETACHED - Input method not bound.
IME_ERR_NULL_POINTER - An unexpected null pointer.
For details about the error codes, see InputMethod_ErrorCode.

OH_InputMethodProxy_SendPrivateCommand()

InputMethod_ErrorCode OH_InputMethodProxy_SendPrivateCommand(InputMethod_InputMethodProxy *inputMethodProxy, InputMethod_PrivateCommand *privateCommand[], size_t size)

Description

Sends a private data command.

Since: 12

Parameters

Name Description
InputMethod_InputMethodProxy *inputMethodProxy Pointer to the InputMethod_InputMethodProxy instance obtained by calling OH_InputMethodController_Attach.
InputMethod_PrivateCommand *privateCommand[] Private command that is defined in InputMethod_PrivateCommand. The maximum size is 32 KB.
size_t size Size of the private command array. The maximum size is 5.

Returns

Type Description
InputMethod_ErrorCode An error code.
IME_ERR_OK - Success.
IME_ERR_PARAMCHECK - Parameter error.
IME_ERR_IMCLIENT - Client error in input method.
IME_ERR_IMMS - Input method service error.
IME_ERR_DETACHED - Input method not bound.
IME_ERR_NULL_POINTER - An unexpected null pointer.
For details about the error codes, see InputMethod_ErrorCode.