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 DEVICE_CONFIG_FILE_PARSER_H 17 #define DEVICE_CONFIG_FILE_PARSER_H 18 19 #include <map> 20 #include <string> 21 22 struct libinput_device; 23 24 struct VendorConfig { 25 int32_t pointerSpeed { -1 }; 26 }; 27 28 namespace OHOS { 29 namespace MMI { 30 enum class ConfigFileItem { 31 INVALID = -1, 32 POINTER_BASE = 0, 33 POINTER_SPEED, 34 }; 35 class DeviceConfigManagement { 36 public: 37 DeviceConfigManagement() = default; 38 ~DeviceConfigManagement() = default; 39 public: 40 VendorConfig GetVendorConfig(struct libinput_device *device) const; 41 42 private: 43 std::string CombDeviceFileName(struct libinput_device *device) const; 44 std::map<ConfigFileItem, int32_t> ReadConfigFile(const std::string &filePath) const; 45 ConfigFileItem ConfigItemName2Id(const std::string &name) const; 46 }; 47 } // namespace MMI 48 } // namespace OHOS 49 #endif // DEVICE_CONFIG_FILE_PARSER_H