1 /* 2 * Copyright (c) 2022-2024 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 #ifndef LNN_HEARTBEAT_UTILS_H 17 #define LNN_HEARTBEAT_UTILS_H 18 19 #include "data_level_inner.h" 20 #include "softbus_common.h" 21 #include "lnn_heartbeat_utils_struct.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 bool LnnVisitHbTypeSet(VisitHbTypeCb callback, LnnHeartbeatType *typeSet, void *data); 28 29 LnnHeartbeatType LnnConvertConnAddrTypeToHbType(ConnectionAddrType addrType); 30 ConnectionAddrType LnnConvertHbTypeToConnAddrType(LnnHeartbeatType type); 31 int32_t LnnConvertHbTypeToId(LnnHeartbeatType type); 32 bool LnnHasActiveConnection(const char *networkId, ConnectionAddrType addrType); 33 bool LnnCheckSupportedHbType(LnnHeartbeatType *srcType, LnnHeartbeatType *dstType); 34 int32_t LnnGetShortAccountHash(uint8_t *accountHash, uint32_t len); 35 int32_t LnnGenerateHexStringHash(const unsigned char *str, char *hashStr, uint32_t len); 36 int32_t LnnGenerateBtMacHash(const char *btMac, int32_t brMacLen, char *brMacHash, int32_t hashLen); 37 bool LnnIsSupportBurstFeature(const char *networkId); 38 bool LnnIsLocalSupportBurstFeature(void); 39 void LnnDumpLocalBasicInfo(void); 40 void LnnDumpOnlineDeviceInfo(void); 41 uint32_t GenerateRandomNumForHb(uint32_t randMin, uint32_t randMax); 42 bool LnnIsMultiDeviceOnline(void); 43 bool LnnIsSupportHeartbeatCap(uint32_t hbCapacity, HeartbeatCapability capaBit); 44 45 #ifdef __cplusplus 46 } 47 #endif 48 #endif /* LNN_HEARTBEAT_UTILS_H */ 49