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 DUALFW_SOUND_SETTING_H 17 #define DUALFW_SOUND_SETTING_H 18 19 #include <functional> 20 #include <string> 21 #include <unordered_map> 22 23 #include "dualfw_conf_parser.h" 24 #include "ringtone_type.h" 25 26 namespace OHOS { 27 namespace Media { 28 struct DualfwSettingItem { 29 std::string toneFileName {}; 30 int32_t settingType {TONE_SETTING_TYPE_INVALID}; 31 int32_t toneType {0}; 32 bool defaultSysSet {false}; 33 bool setFlag {false}; 34 }; 35 36 class DualfwSoundSetting { 37 public: 38 DualfwSoundSetting(); 39 ~DualfwSoundSetting() = default; 40 int32_t ProcessConfRow(std::unique_ptr<DualFwConfRow> &conf); 41 void SettingsTraval(std::function<void (DualfwSettingItem &)> func); 42 private: 43 std::unordered_map<int32_t, DualfwSettingItem> settings_; 44 }; 45 46 } // namespace Media 47 } // namespace OHOS 48 #endif // DUALFW_SOUND_SETTING_H 49