• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 AUDIO_POLICY_GLOBAL_PARSER_H
17 #define AUDIO_POLICY_GLOBAL_PARSER_H
18 
19 #include <vector>
20 #include <unordered_map>
21 #include <string>
22 #include <sstream>
23 #include <libxml/parser.h>
24 #include <libxml/tree.h>
25 
26 #include "audio_info.h"
27 #include "iport_observer.h"
28 #include "parser.h"
29 
30 namespace OHOS {
31 namespace AudioStandard {
32 using namespace std;
33 
34 class AudioPolicyGlobalParser : public Parser {
35 public:
36     static constexpr char POLICY_GLOBAL_CONFIG_FILE[] = "/system/etc/audio/audio_policy_global_config.xml";
37 
38     bool LoadConfiguration() final;
39     bool Parse();
40     void Destroy() final;
41 
AudioPolicyGlobalParser()42     AudioPolicyGlobalParser() {}
43 
44     int32_t GetConfigByKeyName(std::string keyName, uint32_t &value);
45 
~AudioPolicyGlobalParser()46     virtual ~AudioPolicyGlobalParser()
47     {
48         Destroy();
49     }
50 
51 private:
52     bool ParseInternal(xmlNode *node);
53     void ParserAttribute(xmlNode *node);
54 
55     xmlDoc *mDoc_ = nullptr;
56     std::unordered_map<std::string, uint32_t> globalConfigs_;
57 };
58 } // namespace AudioStandard
59 } // namespace OHOS
60 #endif // AUDIO_DEVICE_AFFINITY_PARSER_H
61