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 #ifndef DISC_BLE_CONSTANT_STRUCT_H 17 #define DISC_BLE_CONSTANT_STRUCT_H 18 19 #define INT32_MAX_BIT_NUM 32 20 #define MAX_CAP_NUM (CAPABILITY_NUM * INT32_MAX_BIT_NUM) 21 22 #define BLE_SCAN_FILTER_LEN 7 23 #define SOFTBUS_BLE_CLIENT_ID 0x1 24 #define SHA_HASH_LEN 32 25 #define BT_ADDR_LEN 6 26 #define BLE_DISCOVERY_TYPE_VAL_MAX_LEN 16 27 #define PRE_LINK_MAX_LEN 16 28 #define DISC_EXT_CUST_MAX_LEN 256 29 30 #define BLE_DISCOVERY_KEY_CUST "castPlus" 31 #define BLE_DISCOVERY_KEY_EXT_CUST "extCustData" 32 #define BLE_DISCOVERY_KEY_ACTION_ID "actionId" 33 #define BLE_DISCOVERY_KEY_PRE_LINKTYPE "preLinkType" 34 35 #define BLE_DISCOVERY_KEY_HML "HML" 36 37 #define BLE_DISCOVERY_TYPE "discType" 38 #define BLE_DISCOVERY_TYPE_HANDLE "handle" 39 #define BLE_REPORT_HANDLE_JSON_LEY "handleId" 40 41 /* TLV constant defination */ 42 #define TLV_TYPE_END 0x00 43 #define TLV_TYPE_DEVICE_ID_HASH 0x01 44 #define TLV_TYPE_DEVICE_TYPE 0x02 45 #define TLV_TYPE_DEVICE_NAME 0x03 46 #define TLV_TYPE_CUST 0x04 47 #define TLV_TYPE_BR_MAC 0x05 48 #define TLV_TYPE_RANGE_POWER 0x06 49 #define TLV_TYPE_ACTION 0x07 50 51 #define POS_VERSION 0 52 #define POS_BUSINESS 1 53 #define POS_BUSINESS_EXTENSION 2 54 #define POS_USER_ID_HASH 3 55 #define POS_CAPABILITY 5 56 #define POS_CAPABILITY_EXTENSION 6 57 #define POS_TLV 7 58 59 #define SHORT_USER_ID_HASH_LEN 2 60 #define SHORT_DEVICE_ID_HASH_LENGTH 8 61 #define BT_MAX_STR_LEN 18 62 #define BT_MAC_BYTES_LEN 6 63 #define DEVICE_TYPE_LEN 2 64 #define DEVICE_TYPE_MASK 0xFF 65 #define ONE_BYTE_LENGTH 8 66 #define RANGE_POWER_TYPE_LEN 1 67 68 #endif