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
16 #include "comm_log.h"
17 #include "conn_event.h"
18
19 #include "softbus_event.h"
20
ConnEventInner(int32_t scene,int32_t stage,const char * func,int32_t line,ConnEventExtra * extra)21 void ConnEventInner(int32_t scene, int32_t stage, const char *func, int32_t line, ConnEventExtra *extra)
22 {
23 if (func == NULL || extra == NULL) {
24 COMM_LOGE(COMM_DFX, "func or extra is NUll");
25 return;
26 }
27 SoftbusEventForm form = {
28 .eventName = CONN_EVENT_NAME,
29 .scene = scene,
30 .stage = stage,
31 .func = func,
32 .line = line,
33 .connExtra = extra,
34 };
35 SoftbusEventInner(EVENT_MODULE_CONN, &form);
36 }
37
ConnAlarmInner(int32_t scene,int32_t type,const char * func,int32_t line,ConnAlarmExtra * extra)38 void ConnAlarmInner(int32_t scene, int32_t type, const char *func, int32_t line, ConnAlarmExtra *extra)
39 {
40 if (extra == NULL) {
41 return;
42 }
43 SoftbusEventForm form = {
44 .eventName = (type == MANAGE_ALARM_TYPE) ? MANAGE_ALARM_EVENT_NAME : CONTROL_ALARM_EVENT_NAME,
45 .scene = scene,
46 .stage = SOFTBUS_DEFAULT_STAGE,
47 .func = func,
48 .line = line,
49 .connAlarmExtra = extra,
50 };
51 SoftbusEventInner(EVENT_MODULE_CONN_ALARM, &form);
52 }
53
ConnAuditInner(int32_t scene,const char * func,int32_t line,ConnAuditExtra * extra)54 void ConnAuditInner(int32_t scene, const char *func, int32_t line, ConnAuditExtra *extra)
55 {
56 if (func == NULL || extra == NULL) {
57 COMM_LOGE(COMM_DFX, "func or extra is NUll");
58 return;
59 }
60 SoftbusEventForm form = {
61 .eventName = CONN_AUDIT_NAME,
62 .scene = scene,
63 .stage = SOFTBUS_DEFAULT_STAGE,
64 .func = func,
65 .line = line,
66 .connAuditExtra = extra,
67 };
68 SoftbusAuditInner(EVENT_MODULE_CONN, &form);
69 }