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 LOG_TAG
17 #define LOG_TAG "IHpaeCapturerManager"
18 #endif
19 #include "i_hpae_capturer_manager.h"
20 #include "audio_engine_log.h"
21
22 namespace OHOS {
23 namespace AudioStandard {
24 namespace HPAE {
UploadDumpSourceInfo(std::string & deviceName)25 void IHpaeCapturerManager::UploadDumpSourceInfo(std::string &deviceName)
26 {
27 #ifdef ENABLE_HIDUMP_DFX
28 std::string dumpStr;
29 dfxTree_.PrintTree(dumpStr);
30 TriggerCallback(DUMP_SOURCE_INFO, deviceName, dumpStr);
31 #endif
32 }
33
OnNotifyDfxNodeInfo(bool isConnect,uint32_t preNodeId,HpaeDfxNodeInfo & nodeInfo)34 void IHpaeCapturerManager::OnNotifyDfxNodeInfo(bool isConnect, uint32_t preNodeId, HpaeDfxNodeInfo &nodeInfo)
35 {
36 #ifdef ENABLE_HIDUMP_DFX
37 AUDIO_INFO_LOG("%{public}s preNodeId %{public}u nodeName:%{public}s, NodeId: %{public}u",
38 isConnect ? "connect" : "disconnect",
39 preNodeId,
40 nodeInfo.nodeName.c_str(),
41 nodeInfo.nodeId);
42 if (isConnect) {
43 dfxTree_.Insert(preNodeId, nodeInfo);
44 } else {
45 dfxTree_.Remove(nodeInfo.nodeId);
46 }
47 #endif
48 }
49 } // namespace HPAE
50 } // namespace AudioStandard
51 } // namespace OHOS