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 FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_I_INPUT_DATA_CHANNEL_H 17 #define FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_I_INPUT_DATA_CHANNEL_H 18 #include <errors.h> 19 #include <unordered_map> 20 21 #include "global.h" 22 #include "input_method_utils.h" 23 #include "iremote_broker.h" 24 25 /** 26 * brief Definition of interface IInputDataChannel 27 * It defines the remote calls from input method service to input client 28 */ 29 namespace OHOS { 30 namespace MiscServices { 31 class IInputDataChannel : public IRemoteBroker { 32 public: 33 enum { 34 DATA_CHANNEL_CMD_BEGIN, 35 INSERT_TEXT = DATA_CHANNEL_CMD_BEGIN, 36 DELETE_FORWARD, 37 DELETE_BACKWARD, 38 GET_TEXT_BEFORE_CURSOR, 39 GET_TEXT_AFTER_CURSOR, 40 GET_ENTER_KEY_TYPE, 41 GET_INPUT_PATTERN, 42 SEND_KEYBOARD_STATUS, 43 SEND_FUNCTION_KEY, 44 MOVE_CURSOR, 45 SELECT_BY_RANGE, 46 SELECT_BY_MOVEMENT, 47 HANDLE_EXTEND_ACTION, 48 GET_TEXT_INDEX_AT_CURSOR, 49 GET_TEXT_CONFIG, 50 NOTIFY_PANEL_STATUS_INFO, 51 NOTIFY_KEYBOARD_HEIGHT, 52 SEND_PRIVATE_COMMAND, 53 SET_PREVIEW_TEXT, 54 FINISH_TEXT_PREVIEW, 55 SEND_MESSAGE, 56 DATA_CHANNEL_CMD_END 57 }; 58 59 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.miscservices.inputmethod.IInputDataChannel"); 60 61 virtual int32_t InsertText(const std::u16string &text) = 0; 62 virtual int32_t DeleteForward(int32_t length) = 0; 63 virtual int32_t DeleteBackward(int32_t length) = 0; 64 virtual int32_t GetTextBeforeCursor(int32_t number, std::u16string &text) = 0; 65 virtual int32_t GetTextAfterCursor(int32_t number, std::u16string &text) = 0; 66 virtual int32_t GetTextConfig(TextTotalConfig &textConfig) = 0; 67 virtual void SendKeyboardStatus(KeyboardStatus status) = 0; 68 virtual int32_t SendFunctionKey(int32_t funcKey) = 0; 69 virtual int32_t MoveCursor(int32_t keyCode) = 0; 70 virtual int32_t GetEnterKeyType(int32_t &keyType) = 0; 71 virtual int32_t GetInputPattern(int32_t &inputPattern) = 0; 72 virtual int32_t SelectByRange(int32_t start, int32_t end) = 0; 73 virtual int32_t SelectByMovement(int32_t direction, int32_t cursorMoveSkip) = 0; 74 virtual int32_t HandleExtendAction(int32_t action) = 0; 75 virtual int32_t GetTextIndexAtCursor(int32_t &index) = 0; 76 virtual void NotifyPanelStatusInfo(const PanelStatusInfo &info) = 0; 77 virtual void NotifyKeyboardHeight(uint32_t height) = 0; 78 virtual int32_t SendPrivateCommand(const std::unordered_map<std::string, PrivateDataValue> &privateCommand) = 0; 79 virtual int32_t SetPreviewText(const std::string &text, const Range &range) = 0; 80 virtual int32_t FinishTextPreview(bool isAsync) = 0; 81 virtual int32_t SendMessage(const ArrayBuffer &arraybuffer) = 0; 82 }; 83 } // namespace MiscServices 84 } // namespace OHOS 85 #endif // FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_I_INPUT_DATA_CHANNEL_H 86