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 #ifndef INPUT_PARSE_H 17 #define INPUT_PARSE_H 18 19 #include <string> 20 #include <vector> 21 22 namespace OHOS { 23 namespace MMI { 24 struct Pos { 25 int32_t xPos { 0 }; 26 int32_t yPos { 0 }; 27 std::string ToString() const; 28 }; 29 struct DeviceEvent { 30 std::string eventType; 31 std::vector<int32_t> event; 32 int16_t keyValue { 0 }; 33 int64_t blockTime { 0 }; 34 std::vector<int32_t> ringEvents; 35 std::string direction; 36 int32_t distance { 0 }; 37 int32_t xPos { 0 }; 38 int32_t yPos { 0 }; 39 int32_t tiltX { 0 }; 40 int32_t tiltY { 0 }; 41 int32_t pressure { 0 }; 42 int32_t trackingId { 0 }; 43 int32_t reportType { 0 }; 44 int32_t keyStatus { 0 }; 45 std::vector<Pos> posXY; 46 std::string ToString() const; 47 }; 48 struct DeviceItem { 49 std::string deviceName; 50 int32_t deviceIndex { 0 }; 51 std::vector<DeviceEvent> events; 52 std::string ToString() const; 53 }; 54 typedef std::vector<DeviceItem> DeviceItems; 55 DeviceItems DataInit(const std::string &fileData, bool logStatus); 56 } // namespace MMI 57 } // namespace OHOS 58 #endif // INPUT_PARSE_H