• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "cooperate_hisysevent.h"
17 
18 #include "hisysevent.h"
19 #include "fi_log.h"
20 
21 #undef LOG_TAG
22 #define LOG_TAG "CooperateHisysevent"
23 namespace OHOS {
24 namespace Msdp {
25 namespace DeviceStatus {
26 namespace {
27     const std::string COOPERTATE_BEHAVIOR { "COOPERTATE_BEHAVIOR" };
28     const std::string ORG_PKG_NAME { "device_status" };
29 } // namespace
30 
ReportCooperateRadarInfo(struct CooperateRadarInfo & cooperateRadarInfo)31 void CooperateRadar::ReportCooperateRadarInfo(struct CooperateRadarInfo &cooperateRadarInfo)
32 {
33     HiSysEventWrite(
34         OHOS::HiviewDFX::HiSysEvent::Domain::MSDP,
35         COOPERTATE_BEHAVIOR,
36         HiviewDFX::HiSysEvent::EventType::BEHAVIOR,
37         "ORG_PKG", ORG_PKG_NAME,
38         "FUNC", cooperateRadarInfo.funcName,
39         "BIZ_STATE", cooperateRadarInfo.bizState,
40         "BIZ_STAGE", cooperateRadarInfo.bizStage,
41         "STAGE_RES", cooperateRadarInfo.stageRes,
42         "BIZ_SCENE", cooperateRadarInfo.bizScene,
43         "ERROR_CODE", cooperateRadarInfo.errCode,
44         "HOST_PKG", cooperateRadarInfo.hostName,
45         "LOCAL_NET_ID", cooperateRadarInfo.localNetId,
46         "PEER_NET_ID", cooperateRadarInfo.peerNetId,
47         "TO_CALL_PKG", cooperateRadarInfo.toCallPkg,
48         "LOCAL_DEV_TYPE", cooperateRadarInfo.localDeviceType,
49         "PEER_DEV_TYPE", cooperateRadarInfo.peerDeviceType);
50 }
51 
ReportTransmissionLatencyRadarInfo(struct TransmissionLatencyRadarInfo & transmissionLatencyRadarInfo)52 void CooperateRadar::ReportTransmissionLatencyRadarInfo(
53     struct TransmissionLatencyRadarInfo &transmissionLatencyRadarInfo)
54 {
55     if (transmissionLatencyRadarInfo.stageRes < 0) {
56         FI_HILOGE("Transmission latency HiSysEventWrite fail");
57         return;
58     } else {
59         FI_HILOGD("Transmission latency HiSysEventWrite success");
60     }
61     HiSysEventWrite(
62         OHOS::HiviewDFX::HiSysEvent::Domain::MSDP,
63         COOPERTATE_BEHAVIOR,
64         HiviewDFX::HiSysEvent::EventType::BEHAVIOR,
65         "ORG_PKG", ORG_PKG_NAME,
66         "FUNC", transmissionLatencyRadarInfo.funcName,
67         "BIZ_STATE", transmissionLatencyRadarInfo.bizState,
68         "BIZ_STAGE", transmissionLatencyRadarInfo.bizStage,
69         "STAGE_RES", transmissionLatencyRadarInfo.stageRes,
70         "BIZ_SCENE", transmissionLatencyRadarInfo.bizScene,
71         "LOCAL_NET_ID", transmissionLatencyRadarInfo.localNetId,
72         "PEER_NET_ID", transmissionLatencyRadarInfo.peerNetId,
73         "DRIVE_EVENT_DT", transmissionLatencyRadarInfo.driveEventTimeDT,
74         "COOPERATE_INTERCEPTOR_EVENT_DT", transmissionLatencyRadarInfo.cooperateInterceptorTimeDT,
75         "CROSS_PLATFORM_EVENT", transmissionLatencyRadarInfo.crossPlatformTimeDT,
76         "POINTER_SPEED_EVENT", transmissionLatencyRadarInfo.pointerSpeed,
77         "TOUCHPAD_SPEED_EVET", transmissionLatencyRadarInfo.touchPadSpeed);
78 }
79 
80 } // namespace DeviceStatus
81 } // namespace Msdp
82 } // namespace OHOS
83