1 /* 2 *Copyright (c) 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 16 #include "input_info.h" 17 18 namespace OHOS { 19 namespace WuKong { 20 InputTypeToString()21std::string InputInfo::InputTypeToString() 22 { 23 std::string inputString = ""; 24 switch (inputType_) { 25 case INPUTTYPE_TOUCHINPUT: 26 /* code */ 27 inputString = "touch"; 28 break; 29 case INPUTTYPE_SWAPINPUT: 30 /* code */ 31 inputString = "swap"; 32 break; 33 case INPUTTYPE_MOUSEINPUT: 34 /* code */ 35 inputString = "mouse"; 36 break; 37 case INPUTTYPE_KEYBOARDINPUT: 38 /* code */ 39 inputString = "keyboard"; 40 break; 41 case INPUTTYPE_APPSWITCHINPUT: 42 /* code */ 43 inputString = "appswitch"; 44 break; 45 case INPUTTYPE_HARDKEYINPUT: 46 /* code */ 47 inputString = "hardkey"; 48 break; 49 case INPUTTYPE_ROTATEINPUT: 50 /* code */ 51 inputString = "rotate"; 52 break; 53 default: 54 break; 55 } 56 return inputString; 57 } 58 } // namespace WuKong 59 } // namespace OHOS 60