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 /** 17 * @file softbus_broadcast_utils.h 18 * @brief Declare functions and constants for the softbus broadcast or scan data fill or parse common functions. 19 * 20 * @since 4.1 21 * @version 1.0 22 */ 23 24 #ifndef SOFTBUS_BROADCAST_UTILS_STRUCT_H 25 #define SOFTBUS_BROADCAST_UTILS_STRUCT_H 26 27 #include <stdint.h> 28 29 #ifdef __cplusplus 30 extern "C"{ 31 #endif 32 33 #define MEDIUM_NUM_MAX 2 34 35 // max broadcasting and scan limit 36 #define BC_NUM_MAX 28 // ble for 20 sle for 8 37 #define SCAN_NUM_MAX 24 // ble for 16 sle for 8 38 39 #define BC_DATA_MAX_LEN 24 40 #define RSP_DATA_MAX_LEN 27 41 #define BC_BYTE_MASK 0xFF 42 #define BC_SHIFT_BIT 8 43 44 #define SLE_SCAN_NUM_MAX 8 45 #define SLE_DATA_MAX_LEN 247 46 #define SLE_RSP_DATA_MAX_LEN 250 47 48 // adv broadcast head 49 #define BC_HEAD_LEN 7 50 #define BC_FLAG_LEN 3 51 #define IDX_BC_FLAG_BYTE_LEN 0 52 #define IDX_BC_FLAG_AD_TYPE 1 53 #define IDX_BC_FLAG_AD_DATA 2 54 #define IDX_PACKET_LEN 3 55 #define IDX_BC_TYPE 4 56 #define IDX_BC_UUID 5 57 #define BC_UUID_LEN 2 58 59 #define BC_FLAG_BYTE_LEN 0x2 60 #define BC_FLAG_AD_TYPE 0x1 61 #define BC_FLAG_AD_DATA 0x2 62 63 // broadcast type 64 #define SHORTENED_LOCAL_NAME_BC_TYPE 0x08 65 #define LOCAL_NAME_BC_TYPE 0x09 66 #define SERVICE_BC_TYPE 0x16 67 #define MANUFACTURE_BC_TYPE 0xFF 68 69 // scan rsp head 70 #define RSP_HEAD_LEN 4 71 72 #define IDX_RSP_PACKET_LEN 0 73 #define IDX_RSP_TYPE 1 74 #define IDX_RSP_UUID 2 75 #define RSP_UUID_LEN 2 76 77 #define RSP_FLAG_BYTE_LEN 0x2 78 #define RSP_FLAG_AD_TYPE 0x1 79 #define RSP_FLAG_AD_DATA 0x2 80 81 #ifdef __cplusplus 82 } 83 #endif 84 85 #endif /* SOFTBUS_BROADCAST_UTILS_STRUCT_H */ 86