• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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  * miscservices under the License is miscservices 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 #ifndef SOFTBUS_HISYSEVENT_BUS_CENTER_H
16 #define SOFTBUS_HISYSEVENT_BUS_CENTER_H
17 
18 #include <stdint.h>
19 
20 #include "common_list.h"
21 #include "legacy/softbus_adapter_hisysevent.h"
22 #include "softbus_common.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 typedef enum {
29     MODULE_TYPE_DISCOVERY = 1,
30     MODULE_TYPE_CONNECT = 2,
31     MODULE_TYPE_AUTH = 3,
32     MODULE_TYPE_BUS_CENTER = 4,
33     MODULE_TYPE_ONLINE = 5,
34     MODULE_TYPE_TRANSPORT = 6,
35     MODULE_TYPE_API_CALLED = 7,
36     MODULE_TYPE_BUTT = 8,
37 } SoftBusModuleType;
38 
39 typedef enum {
40     SOFTBUS_HISYSEVT_LINK_TYPE_BR = 0,
41     SOFTBUS_HISYSEVT_LINK_TYPE_BLE = 1,
42     SOFTBUS_HISYSEVT_LINK_TYPE_WLAN = 2,
43     SOFTBUS_HISYSEVT_LINK_TYPE_P2P = 3,
44     SOFTBUS_HISYSEVT_LINK_TYPE_HML = 4,
45     SOFTBUS_HISYSEVT_LINK_TYPE_SLE = 5,
46     SOFTBUS_HISYSEVT_LINK_TYPE_BUTT = 6,
47 } SoftBusLinkType;
48 
49 typedef enum {
50     AUTH_CONNECT_STAGE = 1,
51     AUTH_VERIFY_STAGE = 2,
52     AUTH_EXCHANGE_STAGE = 3,
53     AUTH_STAGE_BUTT,
54 } AuthFailStage;
55 
56 typedef enum {
57     START_DISCOVERY = 1,
58     SEND_BROADCAST = 2,
59     RECV_BROADCAST = 3,
60     DEVICE_FOUND = 4,
61     BUSINESS_DISCOVERY = 5,
62 } DiscoveryStage;
63 
64 typedef struct {
65     uint32_t onlineDevNum;
66     uint32_t btOnlineDevNum;
67     uint32_t wifiOnlineDevNum;
68     uint32_t peerDevType;
69     int32_t insertFileResult;
70     char peerSoftBusVer[SOFTBUS_HISYSEVT_NAME_LEN];
71     char peerDevName[SOFTBUS_HISYSEVT_NAME_LEN];
72     char localSoftBusVer[SOFTBUS_HISYSEVT_NAME_LEN];
73     char peerPackVer[SOFTBUS_HISYSEVT_NAME_LEN];
74     char localPackVer[SOFTBUS_HISYSEVT_NAME_LEN];
75 } OnlineDeviceInfo;
76 
77 typedef struct {
78     bool bleBradStatus;
79     bool bleScanStatus;
80     char businessName[SOFTBUS_HISYSEVT_NAME_LEN];
81     char callerPackName[SOFTBUS_HISYSEVT_NAME_LEN];
82     char remoteBizUuid[SOFTBUS_HISYSEVT_NAME_LEN];
83     uint8_t moduleType;
84     uint8_t linkType;
85     float channelQuality;
86     int32_t errorCode;
87     int32_t peerDevType;
88     int32_t onLineDevNum;
89     int32_t connNum;
90     int32_t nightMode;
91     int32_t wifiStatue;
92     int32_t bleStatue;
93     int32_t callerAppMode;
94     int32_t subErrCode;
95     int32_t connBrNum;
96     int32_t connBleNum;
97 } SoftBusFaultEvtInfo;
98 
99 typedef struct {
100     int32_t appDiscCnt;
101     char appName[SOFTBUS_HISYSEVT_NAME_LEN];
102     ListNode node;
103 } AppDiscNode;
104 
105 typedef struct {
106     uint64_t startAuthTime;
107     uint64_t endAuthTime;
108 } AuthStatisticData;
109 
110 typedef struct {
111     int64_t beginJoinLnnTime;
112     int64_t beginOnlineTime;
113     int64_t offLineTime;
114 } LnnStatisticData;
115 
116 int64_t LnnUpTimeMs(void);
117 void DeinitBusCenterDfx(void);
118 int32_t InitBusCenterDfx(void);
119 int32_t SoftBusRecordDiscoveryResult(DiscoveryStage stage, AppDiscNode *discNode);
120 int32_t SoftBusReportBusCenterFaultEvt(SoftBusFaultEvtInfo *info);
121 int32_t SoftBusReportDevOnlineEvt(OnlineDeviceInfo *info, const char *udid);
122 int32_t SoftBusRecordDevOnlineDurResult(uint64_t constTime);
123 int32_t SoftBusRecordBusCenterResult(SoftBusLinkType linkType, uint64_t constTime);
124 int32_t SoftBusRecordAuthResult(SoftBusLinkType linkType, int32_t ret, uint64_t constTime, AuthFailStage stage);
125 #ifdef __cplusplus
126 }
127 #endif
128 #endif /* SOFTBUS_HISYSEVENT_BUS_CENTER_H */
129