1 /*
2  * Copyright (c) 2023 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 #ifndef INTELL_VOICE_UTIL_H
16 #define INTELL_VOICE_UTIL_H
17 #include <cstdint>
18 #include <string>
19 #include <vector>
20 #include <memory>
21 #include <map>
22 
23 namespace OHOS {
24 namespace IntellVoiceUtils {
25 class IntellVoiceUtil final {
26 public:
27     static uint32_t GetHdiVersionId(uint32_t majorVer, uint32_t minorVer);
28     static bool DeinterleaveAudioData(const int16_t *buffer, uint32_t size, int32_t channelCnt,
29         std::vector<std::vector<uint8_t>> &audioData);
30     static bool VerifySystemPermission(const std::string &permissionName);
31     static bool ReadFile(const std::string &filePath, std::shared_ptr<uint8_t> &buffer, uint32_t &size);
32     static void SplitStringToKVPair(const std::string &inputStr, std::map<std::string, std::string> &kvpairs);
33     static bool IsFileExist(const std::string &filePath);
34 
35 private:
36     static bool VerifyClientPermission(const std::string &permissionName);
37     static bool CheckIsSystemApp();
38 };
39 }
40 }
41 #endif
42