1 /* 2 * Copyright (c) 2023-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 /** 17 * @file softbus_ble_utils.h 18 * @brief ble utils 19 * 20 * @since 4.1 21 * @version 1.0 22 */ 23 24 #ifndef SOFTBUS_BLE_UTILS_H 25 #define SOFTBUS_BLE_UTILS_H 26 27 #include "softbus_broadcast_adapter_interface.h" 28 #include "c_header/ohos_bt_gatt.h" 29 #include "c_header/ohos_bt_def.h" 30 31 #ifdef __cplusplus 32 extern "C"{ 33 #endif 34 35 int32_t BtStatusToSoftBus(BtStatus btStatus); 36 void SoftbusAdvParamToBt(const SoftbusBroadcastParam *src, BleAdvParams *dst); 37 void BtScanResultToSoftbus(const BtScanResultData *src, SoftBusBcScanResult *dst); 38 void SoftbusFilterToBt(BleScanNativeFilter *nativeFilter, const SoftBusBcScanFilter *filter, uint8_t filterSize); 39 void SoftbusSetManufactureFilter(BleScanNativeFilter *nativeFilter, uint8_t filterSize); 40 void FreeBtFilter(BleScanNativeFilter *nativeFilter, int32_t filterSize); 41 void DumpBleScanFilter(BleScanNativeFilter *nativeFilter, int32_t filterSize); 42 int GetBtScanMode(uint16_t scanInterval, uint16_t scanWindow); 43 uint8_t *AssembleAdvData(const SoftbusBroadcastData *data, uint16_t *dataLen); 44 uint8_t *AssembleRspData(const SoftbusBroadcastPayload *data, uint16_t *dataLen); 45 int32_t ParseScanResult(const uint8_t *advData, uint8_t advLen, SoftBusBcScanResult *dst); 46 47 void DumpSoftbusAdapterData(const char *description, uint8_t *data, uint16_t len); 48 49 #ifdef __cplusplus 50 } 51 #endif 52 #endif /* SOFTBUS_BLE_UTILS_H */