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
18 namespace OHOS {
19 namespace DistributedHardware {
20 IMPLEMENT_SINGLE_INSTANCE(DAudioHisysevent);
21
22 #undef DH_LOG_TAG
23 #define DH_LOG_TAG "DAudioHisysevent"
24
SysEventWriteBehavior(const std::string & eventName,const std::string & msg)25 void 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
SysEventWriteBehavior(const std::string & eventName,int32_t saId,const std::string & msg)34 void 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
SysEventWriteBehavior(const std::string & eventName,const std::string & devId,const std::string & dhId,const std::string & msg)44 void 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
SysEventWriteFault(const std::string & eventName,const std::string & msg)56 void 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
SysEventWriteFault(const std::string & eventName,int32_t saId,int32_t errorCode,const std::string & msg)65 void 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
SysEventWriteFault(const std::string & eventName,int32_t errorCode,const std::string & msg)77 void 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
SysEventWriteFault(const std::string & eventName,const std::string & devId,const std::string & dhId,int32_t errorCode,const std::string & msg)87 void 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