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#include "daudio_hisysevent.h" 17 18namespace OHOS { 19namespace DistributedHardware { 20IMPLEMENT_SINGLE_INSTANCE(DAudioHisysevent); 21 22#undef DH_LOG_TAG 23#define DH_LOG_TAG "DAudioHisysevent" 24 25void DAudioHisysevent::SysEventWriteBehavior(const std::string &eventName, const std::string &msg) 26{ 27 HiSysEventWrite( 28 OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_AUDIO, 29 eventName, 30 OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, 31 "MSG", msg); 32} 33 34void DAudioHisysevent::SysEventWriteBehavior(const std::string &eventName, int32_t saId, const std::string &msg) 35{ 36 HiSysEventWrite( 37 OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_AUDIO, 38 eventName, 39 OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, 40 "SAID", saId, 41 "MSG", msg); 42} 43 44void DAudioHisysevent::SysEventWriteBehavior(const std::string &eventName, const std::string &devId, 45 const std::string &dhId, const std::string &msg) 46{ 47 HiSysEventWrite( 48 OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_AUDIO, 49 eventName, 50 OHOS::HiviewDFX::HiSysEvent::EventType::BEHAVIOR, 51 "DEVID", GetAnonyString(devId), 52 "DHID", GetAnonyString(dhId), 53 "MSG", msg); 54} 55 56void DAudioHisysevent::SysEventWriteFault(const std::string &eventName, const std::string &msg) 57{ 58 HiSysEventWrite( 59 OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_AUDIO, 60 eventName, 61 OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, 62 "MSG", msg); 63} 64 65void DAudioHisysevent::SysEventWriteFault(const std::string &eventName, int32_t saId, int32_t errorCode, 66 const std::string &msg) 67{ 68 HiSysEventWrite( 69 OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_AUDIO, 70 eventName, 71 OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, 72 "SAID", saId, 73 "ERRCODE", errorCode, 74 "MSG", msg); 75} 76 77void DAudioHisysevent::SysEventWriteFault(const std::string &eventName, int32_t errorCode, const std::string &msg) 78{ 79 HiSysEventWrite( 80 OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_AUDIO, 81 eventName, 82 OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, 83 "ERRCODE", errorCode, 84 "MSG", msg); 85} 86 87void DAudioHisysevent::SysEventWriteFault(const std::string &eventName, const std::string &devId, 88 const std::string &dhId, int32_t errorCode, const std::string &msg) 89{ 90 HiSysEventWrite( 91 OHOS::HiviewDFX::HiSysEvent::Domain::DISTRIBUTED_AUDIO, 92 eventName, 93 OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, 94 "DEVID", GetAnonyString(devId), 95 "DHID", GetAnonyString(dhId), 96 "ERRCODE", errorCode, "MSG", msg); 97} 98} // namespace DistributedHardware 99} // namespace OHOS