• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 OHOS_DISTRIBUTED_AUDIO_HIDUMPER_H
17 #define OHOS_DISTRIBUTED_AUDIO_HIDUMPER_H
18 
19 #include <string>
20 #include <vector>
21 
22 #include "audio_capturer.h"
23 #include "audio_info.h"
24 
25 #include "audio_adapter.h"
26 #include "audio_manager.h"
27 #include "daudio_handler.h"
28 #include "single_instance.h"
29 
30 namespace OHOS {
31 namespace DistributedHardware {
32 enum class HidumpFlag {
33     UNKNOWN = 0,
34     GET_HELP,
35     GET_SOURCE_DEVID,
36     GET_SINK_INFO,
37     GET_ABILITY,
38 };
39 class DaudioHidumper {
40     DECLARE_SINGLE_INSTANCE_BASE(DaudioHidumper);
41 
42 public:
43     bool Dump(const std::vector<std::string> &args, std::string &result);
44     DaudioHidumper();
45     ~DaudioHidumper();
46 
47 private:
48     void ShowHelp(std::string &result);
49     int32_t ShowIllegalInfomation(std::string &result);
50     int32_t ProcessDump(const std::string &args, std::string &result);
51 
52     int32_t GetSourceDevId(std::string &result);
53     int32_t GetSinkInfo(std::string &result);
54     int32_t GetAbilityInfo(std::string &result);
55 
56 private:
57     std::string g_sourceDevId_ = "";
58     AudioManager *g_manager = nullptr;
59     AudioAdapterDescriptor *g_devices = nullptr;
60     int32_t g_deviceNum = 0;
61     std::string spkDefault = "1";
62     std::string micDefault = "134217729";
63 };
64 } // namespace DistributedHardware
65 } // namespace OHOS
66 #endif // OHOS_DISTRIBUTED_AUDIO_HIDUMPER_H