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