1 /* 2 * Copyright (c) 2022-2023 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 SOFTBUS_ADAPTER_RANGE_H 17 #define SOFTBUS_ADAPTER_RANGE_H 18 19 #include <stdint.h> 20 21 #include "softbus_utils.h" 22 23 #ifdef __cplusplus 24 #if __cplusplus 25 extern "C" { 26 #endif 27 #endif 28 29 #define SOFTBUS_DEV_IDENTITY_LEN 96 30 // valid value of power is [-128, 10], 11 is considered to be illegal. 31 #define SOFTBUS_ILLEGAL_BLE_POWER 11 32 #define SOFTBUS_MODEL_ID_LEN (HEXIFY_LEN(3)) 33 #define SOFTBUS_SUB_MODEL_ID_LEN (HEXIFY_LEN(1)) 34 #define SOFTBUS_NEW_MODEL_ID_LEN (HEXIFY_LEN(4)) 35 36 typedef struct { 37 int32_t rssi; 38 int8_t power; 39 char identity[SOFTBUS_DEV_IDENTITY_LEN]; 40 char modelId[SOFTBUS_MODEL_ID_LEN]; 41 char subModelId[SOFTBUS_SUB_MODEL_ID_LEN]; 42 char newModelId[SOFTBUS_NEW_MODEL_ID_LEN]; 43 } SoftBusRangeParam; 44 45 int SoftBusBleRange(SoftBusRangeParam *param, int32_t *range); 46 int SoftBusGetBlePower(int8_t *power); 47 48 #ifdef __cplusplus 49 #if __cplusplus 50 } 51 #endif /* __cplusplus */ 52 #endif /* __cplusplus */ 53 54 #endif /* SOFTBUS_ADAPTER_RANGE_H */ 55