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_HISYSEVT_DISCREPORTER_H 16 #define SOFTBUS_HISYSEVT_DISCREPORTER_H 17 18 #include "softbus_adapter_hisysevent.h" 19 20 #ifdef __cplusplus 21 #if __cplusplus 22 extern "C" { 23 #endif 24 #endif 25 26 typedef enum { 27 SOFTBUS_HISYSEVT_DISC_MEDIUM_BLE = 1, 28 SOFTBUS_HISYSEVT_DISC_MEDIUM_COAP, 29 30 SOFTBUS_HISYSEVT_DISC_MEDIUM_BUTT, 31 } SoftBusDiscMedium; 32 33 typedef enum { 34 SOFTBUS_HISYSEVT_DISC_ERRCODE_TIMEOUT = 0, 35 SOFTBUS_HISYSEVT_DISCOVER_NOT_INIT, 36 SOFTBUS_HISYSEVT_DISCOVER_MANAGER_INNERFUNCTION_FAIL, 37 SOFTBUS_HISYSEVT_DISCOVER_COAP_MERGE_CAP_FAIL, 38 SOFTBUS_HISYSEVT_DISCOVER_COAP_REGISTER_CAP_FAIL, 39 SOFTBUS_HISYSEVT_DISCOVER_COAP_SET_FILTER_CAP_FAIL, 40 SOFTBUS_HISYSEVT_DISCOVER_COAP_START_DISCOVER_FAIL, 41 SOFTBUS_HISYSEVT_DISCOVER_COAP_STOP_DISCOVER_FAIL, 42 SOFTBUS_HISYSEVT_DISCOVER_COAP_CANCEL_CAP_FAIL, 43 SOFTBUS_HISYSEVT_ERR, 44 SOFTBUS_HISYSEVT_DISC_ERRCODE_BUTT, 45 }SoftBusDiscErrCode; 46 47 typedef struct { 48 uint64_t startTime; 49 uint32_t repTimes; 50 uint32_t devNum; 51 uint32_t discTimes; 52 } DiscoveryStatistics; 53 54 int32_t SoftbusRecordFirstDiscTime(SoftBusDiscMedium medium, uint64_t costTime); 55 56 int32_t SoftbusRecordBleDiscDetails(char *moduleName, uint64_t duration, uint32_t repTimes, uint32_t devNum, 57 uint32_t discTimes); 58 59 int32_t SoftbusRecordDiscBleRssi(int32_t rssi); 60 61 int32_t SoftbusReportDiscFault(SoftBusDiscMedium medium, int32_t errCode); 62 63 int32_t InitDiscStatisticSysEvt(void); 64 65 void DeinitDiscStatisticSysEvt(void); 66 67 #ifdef __cplusplus 68 #if __cplusplus 69 } 70 #endif /* __cplusplus */ 71 #endif /* __cplusplus */ 72 73 #endif /* SOFTBUS_HISYSEVT_DISCREPORTER_H */