1 /** 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 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 * Description: SLE PUBLIC API module. 15 */ 16 17 /** 18 * @defgroup sle_common PUBLIC API 19 * @ingroup SLE 20 * @{ 21 */ 22 23 #ifndef SLE_COMMON_H 24 #define SLE_COMMON_H 25 26 #include <stdint.h> 27 #include "errcode.h" 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif 32 33 /** 34 * @if Eng 35 * @brief SLE version 1.0. 36 * @else 37 * @brief SLE版本1.0。 38 * @endif 39 */ 40 #define SLE_VERSION 0x10 41 42 /** 43 * @if Eng 44 * @brief SLE address length. 45 * @else 46 * @brief SLE地址长度。 47 * @endif 48 */ 49 #define SLE_ADDR_LEN 6 50 51 /** 52 * @if Eng 53 * @brief SLE device name max length. 54 * @else 55 * @brief SLE设备名称最大长度。 56 * @endif 57 */ 58 #define SLE_NAME_MAX_LEN 31 59 60 /** 61 * @if Eng 62 * @brief SLE link key length. 63 * @else 64 * @brief SLE 链路密钥长度。 65 * @endif 66 */ 67 #define SLE_LINK_KEY_LEN 16 68 69 /** 70 * @if Eng 71 * @brief SLE address type. 72 * @else 73 * @brief SLE地址类型。 74 * @endif 75 */ 76 typedef enum { 77 SLE_ADDRESS_TYPE_PUBLIC = 0, /*!< @if Eng public address 78 @else 公有地址 @endif */ 79 SLE_ADDRESS_TYPE_RANDOM = 6, /*!< @if Eng random address 80 @else 随机地址 @endif */ 81 } sle_addr_type_t; 82 83 /** 84 * @if Eng 85 * @brief Struct of device address. 86 * @else 87 * @brief 设备地址。 88 * @endif 89 */ 90 typedef struct { 91 uint8_t type; /*!< @if Eng SLE device address type { @ref sle_addr_type_t } 92 @else SLE设备地址类型 { @ref sle_addr_type_t } @endif */ 93 unsigned char addr[SLE_ADDR_LEN]; /*!< @if Eng SLE device address 94 @else SLE设备地址 @endif */ 95 } sle_addr_t; 96 97 #ifdef __cplusplus 98 } 99 #endif 100 #endif /* SLE_COMMON_H */ 101 /** 102 * @} 103 */ 104 105