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_CONF_LOADER_H
17 #define DUALFWK_CONF_LOADER_H
18 
19 #include <string>
20 #include <memory>
21 
22 #include "ringtone_log.h"
23 #include "datashare_helper.h"
24 #include "ringtone_restore_type.h"
25 
26 namespace OHOS {
27 namespace Media {
28 struct DualFwkConf {
29     int32_t id;
30     // 通知铃音
31     std::string notificationSoundPath;
32     // 卡1 铃音
33     std::string ringtonePath;
34     // 卡2 铃音
35     std::string ringtone2Path;
36     // 闹钟默认铃声
37     std::string alarmAlertPath;
38     // 卡1 短信
39     std::string messagePath;
40     // 卡2 短信
41     std::string messageSub1;
42 };
43 
44 class DualFwkConfLoader {
45 public:
46     DualFwkConfLoader();
47     int32_t Init();
~DualFwkConfLoader()48     ~DualFwkConfLoader() {};
49     int32_t Load(DualFwkConf &conf, const RestoreSceneType &type, const std::string &backupFile);
50     void ShowConf(const DualFwkConf &conf);
51 private:
52     std::string GetConf(const std::string &key);
53     std::shared_ptr<DataShare::DataShareHelper> dataShareHelper_;
54     std::string settingsDataUri_;
55 };
56 } // namespace Media
57 } // namespace OHOS
58 #endif // DUALFWK_CONF_LOADER_H