1 /* 2 * Copyright (C) 2024 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 DUALFWK_SOUND_SETTING_H 17 #define DUALFWK_SOUND_SETTING_H 18 19 #include <functional> 20 #include <string> 21 #include <unordered_map> 22 #include <vector> 23 24 #include "dualfwk_conf_parser.h" 25 #include "dualfwk_conf_loader.h" 26 #include "ringtone_type.h" 27 28 namespace OHOS { 29 namespace Media { 30 struct DualFwkSettingItem { 31 std::string toneFileName {}; 32 int32_t settingType {TONE_SETTING_TYPE_INVALID}; 33 int32_t toneType {0}; 34 bool defaultSysSet {false}; 35 bool setFlag {false}; 36 bool isTitle {false}; 37 }; 38 39 class DualFwkSoundSetting { 40 public: 41 DualFwkSoundSetting(); 42 ~DualFwkSoundSetting() = default; 43 int32_t ProcessConfRow(std::unique_ptr<DualFwkConfRow> &conf); 44 void SettingsTraval(std::function<void (DualFwkSettingItem &)> func); 45 void ProcessConf(const DualFwkConf &conf); 46 std::vector<std::string> GetFileNames() const; 47 std::vector<std::string> GetDisplayNames() const; 48 std::vector<DualFwkSettingItem> GetSettings() const; 49 private: 50 std::unordered_map<int32_t, DualFwkSettingItem> settings_; 51 }; 52 53 } // namespace Media 54 } // namespace OHOS 55 #endif // DUALFWK_SOUND_SETTING_H 56