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 FM_IMMS_PROJECT_IINPUTDATACHANNEL_H 17 #define FM_IMMS_PROJECT_IINPUTDATACHANNEL_H 18 #include <errors.h> 19 #include "iremote_broker.h" 20 #include "global.h" 21 #include "input_method_utils.h" 22 23 /** 24 * brief Definition of interface IInputDataChannel 25 * It defines the remote calls from input method service to input client 26 */ 27 namespace OHOS { 28 namespace MiscServices { 29 class IInputDataChannel : public IRemoteBroker { 30 public: 31 enum { 32 INSERT_TEXT = 0, 33 DELETE_FORWARD, 34 DELETE_BACKWARD, 35 CLOSE, 36 GET_TEXT_BEFORE_CURSOR, 37 GET_TEXT_AFTER_CURSOR, 38 GET_ENTER_KEY_TYPE, 39 GET_INPUT_PATTERN, 40 STOP_INPUT, 41 SEND_KEYBOARD_STATUS, 42 SEND_FUNCTION_KEY, 43 MOVE_CURSOR, 44 }; 45 46 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.miscservices.inputmethod.IInputDataChannel"); 47 48 virtual bool InsertText(const std::u16string& text) = 0; 49 virtual bool DeleteForward(int32_t length) = 0; 50 virtual bool DeleteBackward(int32_t length) = 0; 51 virtual void Close() = 0; 52 virtual std::u16string GetTextBeforeCursor(int32_t number) = 0; 53 virtual std::u16string GetTextAfterCursor(int32_t number) = 0; 54 virtual void SendKeyboardStatus(int32_t status) = 0; 55 virtual void SendFunctionKey(int32_t funcKey) = 0; 56 virtual void MoveCursor(int32_t keyCode) = 0; 57 virtual int32_t GetEnterKeyType() = 0; 58 virtual int32_t GetInputPattern() = 0; 59 virtual void StopInput() = 0; 60 }; 61 } 62 } 63 #endif // FM_IMMS_PROJECT_IINPUTDATACHANNEL_H 64